Skip to content

Instantly share code, notes, and snippets.

@chadgh
Created June 15, 2011 19:05
Show Gist options
  • Save chadgh/1027833 to your computer and use it in GitHub Desktop.
Save chadgh/1027833 to your computer and use it in GitHub Desktop.
defines a function to move up X number of directories in bash
updir(){
if [ $# -gt 0 ];then
path=""
for (( i=1; i<=$1; i++ )); do
path=$path"../"
done
cd $path
else
cd ../
fi
}
alias up='updir'
@chadgh
Copy link
Author

chadgh commented Jun 15, 2011

$ up
will move up one directory

$ up 2
will move up two directories

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment