Skip to content

Instantly share code, notes, and snippets.

@arisawa
Created August 13, 2011 08:32
Show Gist options
  • Save arisawa/1143624 to your computer and use it in GitHub Desktop.
Save arisawa/1143624 to your computer and use it in GitHub Desktop.
switching perlbrew in .bashrc
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