K.S. Bhaskar on 1 Oct 2009 14:03:46 -0700

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

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

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

-- Bhaskar

On Thu, Oct 1, 2009 at 4:32 PM, K.S. Bhaskar <bhaskar@bhaskars.com> wrote:
> I have to write some POSIX shell scripts (actually, they need run
> under busybox sh in TinyCoreLinux) and I have learned to love pushd
> and popd in my scripts.  Any suggestions on the best way to achieve
> the same effect?  Thanks in advance.
> Regards
> -- Bhaskar
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug