which takes you to the previous directory
I've got quite into this as I jump about, freebsd had pushcd and popcd which was also fun.
fn cd {
cdnextlastdir = `{pwd}
{
if(~ $#* 0)
builtin cd
if not if(~ $1 -)
builtin cd $cdlastdir
if not
builtin cd $1
} && cdlastdir = $cdnextlastdir
}
I've got it in lib/profile
EXAMPLE
t23% cd
t23% pwd
/usr/maht
t23% cd /
t23% pwd
/
t23% cd -
t23% pwd
/usr/maht
t23% cd ouihouihiuh
Can't cd ouihouihiuh: 'ouihouihiuh' file does not exist
t23% cd -
t23% pwd
/
t23% cd -
t23% pwd
/usr/maht
t23%
No comments:
Post a Comment