D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] remember current directory, change, cahnge back



Nick Kew wrote:

Yet another option: do it in a subshell:
  ( cd otherdir && othercommand )

Assuming he wants to do something after changing back to the
original directory.

Otherwise when the shell script terminates the original
directory will be in effect, as a shell script doesn't generally
alter it's parent's environment, as Nick clearly knows.

x=`pwd` - runs a sub process when most shells have a perfectly
good built-in for the current directory ;-)

popd is neat, but maybe overkill if OLDPWD will do.

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly