Skip to content

Instantly share code, notes, and snippets.

@foxleigh81
Last active December 14, 2018 14:37
Show Gist options
  • Save foxleigh81/6c58eb5e01af519fe010b0560f187db7 to your computer and use it in GitHub Desktop.
Save foxleigh81/6c58eb5e01af519fe010b0560f187db7 to your computer and use it in GitHub Desktop.
Bash script to go up x directories
up() {
if [[ $@ == 1 ]]; then
# Go up one folder (cd ..)
cd ..
elif [[ $@ == 2 ]]; then
# Go up two folders (cd ../..)
cd ../..
elif [[ $@ == 3 ]]; then
# Go up three folders (cd ../../..)
cd ../../..
else
echo "'Up' requires a parameter of 1,2 or 3"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment