Last active
August 3, 2024 16:59
-
-
Save senthilmpro/7afe88b351a2d308ea59e1328e70ff76 to your computer and use it in GitHub Desktop.
dir-change.sh
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
# shorthand to navigate your folders | |
# add this to ~/.zshrc | |
# then run "source ~/.zshrc" | |
# usage "dir music" | |
# "dir dl" | |
dir() { | |
local user=$(whoami) | |
local folder="$1" | |
if [ -z "$folder" ]; then | |
echo "The input string is empty." | |
elif [[ "$folder" == *"telegram"* ]]; then | |
cd "/Users/$user/telegram" | |
elif [[ "$folder" == "dl" ]]; then | |
cd "/Users/$user/Downloads" | |
elif [[ "$folder" == "music" ]]; then | |
cd "/Users/$user/Music" | |
elif [[ "$folder" == "desktop" ]]; then | |
cd "/Users/$user/Desktop" | |
elif [[ "$folder" == "root" ]]; then | |
cd "/Users/$user" | |
else | |
echo "Invalid selection" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment