For a script I need the pushd and popd internals commonly used in bash csh and friends. Since ksh does not come with these two I did it myself:
function pushd { cd $1 DIR=`pwd` export __DIRSTK="$DIR":$__DIRSTK }
function popd { DIR=`echo $__DIRSTK|cut -f 2 -d:` if test "$DIR" != "" then cd $DIR; else cd - fi export __DIRSTK=`echo $__DIRSTK|cut -f 2- -d:` }