|
@@ -216,25 +216,29 @@ cd(){ |
|
|
if test $# -eq 0 |
|
|
if test $# -eq 0 |
|
|
then |
|
|
then |
|
|
pushd ~/ >/dev/null |
|
|
pushd ~/ >/dev/null |
|
|
|
|
|
elif ! test -d "$1" |
|
|
|
|
|
then |
|
|
|
|
|
echo `basename ${SHELL}`: cd: "$1": No such file or directory 2>&1 |
|
|
|
|
|
return 1 |
|
|
elif test $1 = - |
|
|
elif test $1 = - |
|
|
then |
|
|
then |
|
|
local pwd="$PWD" |
|
|
local pwd="$PWD" |
|
|
popd >/dev/null |
|
|
popd >/dev/null |
|
|
pushd -n "$pwd" >/dev/null # stack last dir |
|
|
pushd -n "$pwd" >/dev/null # stack last dir |
|
|
else |
|
|
else |
|
|
pushd "$@" >/dev/null |
|
|
|
|
|
|
|
|
pushd "$1" >/dev/null |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pushd(){ |
|
|
pushd(){ |
|
|
local pwd="$PWD" |
|
|
|
|
|
for l in $(\dirs -v -l | \grep "^ [0-9]\+ *${pwd}$" | cut -d " " -f 2 | tac) |
|
|
|
|
|
|
|
|
local next="$(realpath "$1")" |
|
|
|
|
|
for l in $(\dirs -v -l | \grep "^ [0-9]\+ *${next}$" | cut -d " " -f 2 | tac) |
|
|
do |
|
|
do |
|
|
echo $l |
|
|
echo $l |
|
|
test $l -eq 0 && continue |
|
|
test $l -eq 0 && continue |
|
|
popd +$l -n |
|
|
popd +$l -n |
|
|
done |
|
|
done |
|
|
command pushd "$@" >/dev/null |
|
|
|
|
|
|
|
|
command pushd "$1" >/dev/null |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
input(){ |
|
|
input(){ |
|
|