On Tue, 5 Feb 2019 13:49:31 -0500
Scott Kostyshak <[email protected]> wrote:

> On Tue, Feb 05, 2019 at 12:35:55PM +0200, Dr Eberhard Lisse wrote:
> > Scott,
> > 
> > this is very helpful for my alias file on the Mac.
> > 
> > function lyxconfigure
> > {
> >     pushd ~/
> >     python -tt
> > "/Applications/LyX.app/Contents/Resources/configure.py" popd
> > }  
> 
> Nice. Thanks for sharing I actually never saw that trick for saving
> the directory in a bash function (I've only used pushd and popd
> interactively). I am used to saving "$(pwd)" to a variable and then
> "cd" back to it. I like your trick instead.

Beware that pushd and popd are bash-only, and do not appear in dash or
any /bin/sh one should be using for shellscripts. I'm of the opinion,
especially after the Heartbleed fiasco, that bash is just too big an
attack surface to use for shellscripts.

In more lightweight shells, it's done more like this:

#!/bin/sh
orgdir=`pwd`
cd /home/you/application/directory
./my_special_application arg1 arg2 arg3
cd $orgdir

SteveT
-- 
Steve Litt 
January 2019 featured book: Troubleshooting: Just the Facts
http://www.troubleshooters.com/tjust

Reply via email to