Created
September 6, 2024 17:08
-
-
Save Trippnology/13f99d337f736f4b960f5dfb44478ea6 to your computer and use it in GitHub Desktop.
Walk up the directory tree
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
# Walk up the directory tree | |
# Pass in a number to walk up that many levels | |
function up() { | |
COUNTER=${1-1} | |
while [[ $COUNTER -gt 0 ]] | |
do | |
UP="${UP}../" | |
let COUNTER-=1 | |
done | |
echo "cd $UP" | |
cd $UP | |
UP='' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment