bash - enhanced cd
This time, i want to share a small enhancement for the "mkdir" bash command. The code i will paste below is doing the following thing. If you supply a number like 3, this function tries to goes up three directory levels. If you supply a string, it behaves like the normal cd.
function net_bazzline_cd() { #numeric value given? if [ `expr $1 + 1 2> /dev/null` ]; then for (( i=1; i <= $1; i++ )) do cd .. done else cd "$1" fi }Sourceode available on github.com.
Kommentare
Ansicht der Kommentare: Linear | Verschachtelt