diff options
-rw-r--r-- | cdlog.sh | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -57,28 +57,22 @@ cdlog.rot() local p=$cur local n=$cur local d=("" "$c1" "$c2" "$c3" "$c4" "$c5" "$c6" "$c7" "$c8" "$c9") + local first=y unset d[0] [ $# -gt 0 ] || set 1 - n=$1; shift - case $n in - ( [1-9] ) - command cd "${d[$n]}" || return - p=$n - ;; - ( * ) - printf "cdlog.rot: bad argument: %s\n" "$n" - return 1 - ;; - esac - while [ $# -gt 0 ] ; do n=$1; shift case $n in ( [1-9] ) - d[$p]=${d[$n]} + if [ $first ] ; then + command cd "${d[$n]}" || return + else + d[$p]=${d[$n]} + fi + first= p=$n ;; ( * ) |