-
-
Save foxleigh81/6c58eb5e01af519fe010b0560f187db7 to your computer and use it in GitHub Desktop.
Bash script to go up x directories
This file contains 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
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