cd - 1>&2 >/dev/null doesn't work right on Solaris -
i use command in script aix , rhel:
cd - 1>&2 >/dev/null i know trying go previous directory after changing directory.
while exact same logic works aix , rhel, it’s apparently not quite working on solaris, error got implying there’s no previous directory go to, when in fact script had change directory /etc/opt/esmsym.
how make work on solaris?
do have alternative?
try running:
cd $oldpwd that should take previous working directory.
or, if doesn't work try using this:
export path=$(pwd) cd ~/b/ cd $path this saves copy of current path $path variable , changes current directory ~/b/ , uses $path variable return previous working directory.
just side-note, there's podp , pushd
pushd $(pwd) cd /tmp popd taken popd(1):
pushd pushes directory onto directory stack. no arguments, exchange top 2 elements. +n rotate n’th entry top of stack , cd it. dir push current working directory onto stack , change dir. popd pops directory stack , cd new top directory. elements of directory stack numbered 0 starting @ top. +n discard n’th entry in stack.
Comments
Post a Comment