sean finney on 1 Oct 2009 14:41:22 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] POSIX shell equivalents of pushd and popd


On Thu, Oct 01, 2009 at 05:03:41PM -0400, K.S. Bhaskar wrote:
> I can't think of anything better than:
> dirtmp="$PWD;$dirtmp" ; cd xxx # pushd
> cd `echo $dirtmp | cut --delimiter ";" --fields=1` ; dirtmp=`echo
> $dirtmp | cut --delimiter=";" --fields=2-` # popd

and then hope you don't ever need to pushd/popd a directory with a
semicolon in it's name :)

if you want to get super paranoid, you can quote the individual
directories and then store them as a space seperated list.  i wrote
about something similar a few months back[1][2] in the context of
positional parameters, but i think it's the same basic problem.



Attachment: signature.asc
Description: Digital signature

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --