Created
June 15, 2011 19:05
-
-
Save chadgh/1027833 to your computer and use it in GitHub Desktop.
defines a function to move up X number of directories in bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
updir(){ | |
if [ $# -gt 0 ];then | |
path="" | |
for (( i=1; i<=$1; i++ )); do | |
path=$path"../" | |
done | |
cd $path | |
else | |
cd ../ | |
fi | |
} | |
alias up='updir' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ up
will move up one directory
$ up 2
will move up two directories