[plug] pushd and popd

Gregory Orange home at oranges.id.au
Thu Jan 20 17:25:52 AWST 2022


Yeah I suppose I would look to that too. I try really hard to avoid
requiring or using a certain cwd in scripts, but it's not always possible.


On 20/1/22 4:14 pm, Dean Bergin wrote:
> I always thought that popd and pushd is useful in scripts to do what you
> need to do within your script and easily return to the original working
> directory of the user without them even knowing that directory changes
> occured or knowing what directory they where in before the script was
> executed.
>
> One thing that annoys me greatly is when scripts mess with my pwd or
> $OLDPWD because the developer was too lazy to keep track of the pwd
> before execution or leveraging pushd and popd.
>
>
> On Thu, 20 Jan 2022, 13:41 Gregory Orange, <home at oranges.id.au
> <mailto:home at oranges.id.au>> wrote:
>
>     On 20/1/22 1:06 pm, Juneidy wrote:
>      > I wonder if anyone here used `pushd` and `popd` frequently? What
>     sort of
>      > navigation would you use that for?
>      >
>      > The best example someone in office told me is if you are following
>      > source code's function call and does not have terminal
>     multiplexer like
>      > GNU screen, `pushd` is good if you want to check other source code
>      > containing the function definition and you can navigate back to the
>      > calling source code directory just by calling `popd`.
>
>     That's exactly the sort of follow-the-bouncing-ball tactic I have used a
>     few times here and there, but I can't quite seem to form a habit out of
>     it. I'm a rare screen/tmux user too.
>
>     I tend to like seeing one and the other and being able to jump between
>     them or see them together though. So, I end up with lots of tabs in my
>     terminals, and separate terminals when I want to show them on screen
>     together.
>
>     Greg.
>
>     _______________________________________________
>     PLUG discussion list: plug at plug.org.au <mailto:plug at plug.org.au>
>     http://lists.plug.org.au/mailman/listinfo/plug
>     <http://lists.plug.org.au/mailman/listinfo/plug>
>     Committee e-mail: committee at plug.org.au <mailto:committee at plug.org.au>
>     PLUG Membership: http://www.plug.org.au/membership
>     <http://www.plug.org.au/membership>
>


--
Gregory Orange



More information about the plug mailing list