shrc: better cding.

This commit is contained in:
Andrey Parhomenko 2022-11-09 05:28:19 +05:00
parent 86a001ede7
commit e87d654067

View file

@ -11,7 +11,13 @@ tmpcdfile=`mktemp`
c() { c() {
oldpwd=`pwd` oldpwd=`pwd`
if command cd $@ && test -n $1 ; then path=""
for v in $@ ; do
path="$path$v/"
done
if eval "command cd $path" && test -n $1 ; then
cat $CDHIST > $tmpcdfile cat $CDHIST > $tmpcdfile
{ pwd ; goblin cat $tmpcdfile ; } | \ { pwd ; goblin cat $tmpcdfile ; } | \
sed $CDHISTMAX'q' | \ sed $CDHISTMAX'q' | \
@ -36,7 +42,7 @@ acds() {
cat $CDHIST cat $CDHIST
} }
bcd() { b() {
num=$1 num=$1
if test "$1" = "" ; then if test "$1" = "" ; then
num=1 num=1
@ -47,6 +53,14 @@ bcd() {
c "$backcd" c "$backcd"
} }
e() {
$EDITOR $@
}
t() {
tree $@
}
PS1=$PROMPT PS1=$PROMPT
test -r "$LOGIN" && . "$LOGIN" test -r "$LOGIN" && . "$LOGIN"