$ cd(), do a ls (or whatever you can imagine) after a cd, func to long please refer to descriptionsome people on the net already use a cd(), but most of them break 'cd -' functionality,
that is "go back where you have been previosly", or 'cd' which is "go back home".
This cd() copes with that. Also when given a file name, go to the directory where this file is in.
cd()
{
if [[ -n ${*} ]]
then
if [[ s${*}e == s-e ]]
then
builtin cd -
elif [[ ! -d ${*} ]]
then
builtin cd "${*%/*}"
else
builtin cd "${*}"
fi
else
builtin cd ~
fi
ls -la
}
by David Winterbottom (codeinthehole.com)
from All commands http://ift.tt/1K4HEF1
No comments:
Post a Comment