-
-
Save technige/aa0801f769fd4e7a7f97d0a093c08531 to your computer and use it in GitHub Desktop.
Alt switcher for bash
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
#!/usr/bin/env bash | |
MENU=$1 | |
OPTION=$2 | |
MENU_PATH=${HOME}/.alt/${MENU} | |
cd ${MENU_PATH} | |
if [ ! -z "$OPTION" ] | |
then | |
rm -f .current | |
ln -s ${OPTION} .current | |
fi | |
CURRENT_OPTION=$(readlink .current) | |
for OPTION in $(ls ${MENU_PATH}) | |
do | |
if [ "${OPTION}" == "${CURRENT_OPTION}" ] | |
then | |
echo -e "\033[36;1m${OPTION}\033[0m" | |
else | |
echo "${OPTION}" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment