-
-
Save oss6/40a29edd5b66629e69f9 to your computer and use it in GitHub Desktop.
Shell function to easily go up through the directory tree without all those dots (cd ../../../../ ---> up 4)
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
#!/bin/bash | |
function up() { | |
if [ $# -ne 1 ] | |
then | |
echo "You must provide one argument. e.g. 'up 4'" | |
fi | |
START=1 | |
END=$1 | |
for (( i=$START; i<=$END; i++ )) | |
do | |
cd ../ | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment