Created
August 13, 2011 08:32
-
-
Save arisawa/1143624 to your computer and use it in GitHub Desktop.
switching perlbrew in .bashrc
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
appswitch () { | |
if [ $1 = "app_is_not_selected" ]; then | |
APP_LC="not selected" | |
export PERLBREW_ROOT=$HOME/perl5/perlbrew | |
else | |
APP=$1 | |
APP_LC=`echo $APP | tr '[A-Z]' '[a-z]'` | |
export PERLBREW_ROOT=$HOME/perl5/$APP_LC/perlbrew | |
fi | |
if [ -d $PERLBREW_ROOT ] ; then | |
$PERLBREW_ROOT/bin/perlbrew init > /dev/null 2>&1 | |
source $PERLBREW_ROOT/etc/bashrc | |
export PERLBREW_PERL="not switching" | |
else | |
echo $PERLBREW_ROOT is not found. | |
fi | |
} | |
appprompt () { | |
echo -ne "\e[32m($APP_LC)\e[m \e[36m($PERLBREW_PERL)\e[m " | |
} | |
PROMPT_COMMAND=appprompt | |
alias notuseapp="appswitch app_is_not_selected" | |
notuseapp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment