[plug] pushd and popd
Onno Benschop
onno at itmaze.com.au
Mon Mar 21 11:57:50 AWST 2022
I tend to use a code block in a bash script:
mkdir -p something
(
cd something
echo hello world
)
That way the directory automagically changes back when you exit the code
block.
On Fri, 21 Jan 2022 at 12:17, Steve Foreman <plutowa at iinet.net.au> wrote:
> I also use it in scripts as it doesn't mess with $OLDPWD and easily leaves
> you in the directory you run the script, despite the directories in which
> the script needs to run.
> It makes the use of relative paths in arguments much easier.
> On 21 Jan 2022, at 11:41 am, Brad Campbell <brad at fnarfbargle.com> wrote:
>>
>> On 20/1/22 13:06, Juneidy wrote:
>>
>>> Hi guys,
>>>
>>> I first heard about `pushd` and `popd` from Alistair long time ago and
>>> never really seriously thought about how to use it from my day to day
>>> work. The closest I have used daily is `cd -`.
>>>
>>> Then a conversation in office lead to someone talking about `pushd` and
>>> `popd` again.
>>>
>>> I wonder if anyone here used `pushd` and `popd` frequently? What sort of
>>> navigation would you use that for?
>>>
>>
>>
>> I use them all the time in scripts. On the command line I just use
>> $OLDPWD and bash history, though now you've brought it up I might
>> explore it a bit. Old habits die hard though.
>>
>> Regards,
>> Brad
>>
>> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://lists.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.org.au
> PLUG Membership: http://www.plug.org.au/membership
--
Onno Benschop
()/)/)() ..ASCII for Onno..
|>>? ..EBCDIC for Onno..
--- -. -. --- ..Morse for Onno..
If you need to know: "What computer should I buy?" http://goo.gl/spsb66
ITmaze - ABN: 56 178 057 063 - ph: 04 1219 8888 -
onno at itmaze.com.au
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plug.org.au/pipermail/plug/attachments/20220321/14450da7/attachment.html>
More information about the plug
mailing list