Created
February 26, 2020 18:11
-
-
Save maxlath/724d015d0144880824c3a65482a38e25 to your computer and use it in GitHub Desktop.
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
# Initialize the array of favs | |
source ~/.favs | |
# Create an alias for each of the favs | |
for key in $favs | |
do | |
directory="$favs[$key]" | |
alias $key="cd $directory" | |
done | |
# Set a fav command to define new fav directories | |
fav(){ | |
dir_shortkey=$1 | |
# Associate the current directory to a shortkey | |
echo "favs[${dir_shortkey}]=${PWD}\n" >> ~/.favs | |
# and reload the favs | |
source ~/.favs | |
} |
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
# create an associative array: $favs | |
typeset -A favs | |
# Elements of that array will be added here after |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment