by RadiantSecurity · 7y ago · 0 comments
I mapped 'cd' to 'c' in my bashrc, but while doing it I also mapped 'c' to execute 'ls' as the latter was basically muscle memory whenever I was using cd. The .bashrc function looks like this:
c() { builtin cd "$@" && ls; }
.. () {
local arg=${1:-1};
while [ $arg -gt 0 ]; do
builtin cd .. &> /dev/null;
arg=$(($arg - 1));
done;
} up() {
local ups="."
for((i=0;i<${1:-1};i++)); do
ups="${ups}/.."
done
builtin cd "$ups"
}Though yours looks much nicer ^^"