<div dir="ltr"><div>I tend to use a code block in a bash script:</div><div><br></div><div><span style="font-family:monospace">mkdir -p something</span></div><div><span style="font-family:monospace">(</span></div><div><span style="font-family:monospace"> cd something</span></div><div><span style="font-family:monospace"> echo hello world</span></div><div><span style="font-family:monospace">)</span></div><div><br></div><div>That way the directory automagically changes back when you exit the code block.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 21 Jan 2022 at 12:17, Steve Foreman <<a href="mailto:plutowa@iinet.net.au">plutowa@iinet.net.au</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div dir="auto">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.<br></div>
<div dir="auto">It makes the use of relative paths in arguments much easier.</div>
<div class="gmail_quote">On 21 Jan 2022, at 11:41 am, Brad Campbell <<a href="mailto:brad@fnarfbargle.com" target="_blank">brad@fnarfbargle.com</a>> wrote:<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<pre>On 20/1/22 13:06, Juneidy wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 1ex 0.8ex;border-left:1px solid rgb(114,159,207);padding-left:1ex"> Hi guys,<br> <br> I first heard about `pushd` and `popd` from Alistair long time ago and <br> never really seriously thought about how to use it from my day to day <br> work. The closest I have used daily is `cd -`.<br> <br> Then a conversation in office lead to someone talking about `pushd` and <br> `popd` again.<br> <br> I wonder if anyone here used `pushd` and `popd` frequently? What sort of <br> navigation would you use that for?<br></blockquote><br><br>I use them all the time in scripts. On the command line I just use <br>$OLDPWD and bash history, though now you've brought it up I might <br>explore it a bit. Old habits die hard though.<br><br>Regards,<br>Brad</pre></blockquote></div></div>_______________________________________________<br>
PLUG discussion list: <a href="mailto:plug@plug.org.au" target="_blank">plug@plug.org.au</a><br>
<a href="http://lists.plug.org.au/mailman/listinfo/plug" rel="noreferrer" target="_blank">http://lists.plug.org.au/mailman/listinfo/plug</a><br>
Committee e-mail: <a href="mailto:committee@plug.org.au" target="_blank">committee@plug.org.au</a><br>
PLUG Membership: <a href="http://www.plug.org.au/membership" rel="noreferrer" target="_blank">http://www.plug.org.au/membership</a></blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Onno Benschop<br><br>()/)/)() ..ASCII for Onno..<br>|>>? ..EBCDIC for Onno..<br>--- -. -. --- ..Morse for Onno..<br><br><span style="color:rgb(136,136,136)">If you need to know: "What computer should I buy?" </span><a href="http://goo.gl/spsb66" style="color:rgb(17,85,204)" target="_blank">http://goo.gl/spsb66</a><div><br>ITmaze - ABN: 56 178 057 063 - ph: 04 1219 8888 - <a href="mailto:onno@itmaze.com.au" target="_blank">onno@itmaze.com.au</a></div></div></div>