Skip to content

Instantly share code, notes, and snippets.

@tvlooy
Last active February 14, 2017 21:51
Show Gist options
  • Save tvlooy/8545d42e0f452985b047728207c71422 to your computer and use it in GitHub Desktop.
Save tvlooy/8545d42e0f452985b047728207c71422 to your computer and use it in GitHub Desktop.
Select php engine
#!/bin/bash
# set this is your .bashrc ". ~/Tools/pe.sh 7.0"
# set this in your .bash_aliases "alias pe='. ~/Tools/pe.sh'"
VERSIONS=($(find /usr/local/ -maxdepth 1 -name 'php-*' | sort | cut -c16-))
VERSION=""
if [ -n "$1" ]; then
VERSION=$1
fi
if [[ ! " ${VERSIONS[@]} " =~ " ${VERSION} " ]]; then
PS3="Choose a version: "
select VERSION in ${VERSIONS[*]}; do
echo -e "\nSetting to option $REPLY: $VERSION\n"
/usr/local/php-${VERSION}/bin/php -v
break
done
fi
PATH=/usr/local/php-${VERSION}/bin:/usr/local/php-${VERSION}/sbin
PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
PATH=$PATH:/home/tvl/Tools
PATH=$PATH:/home/tvl/Tools/scala-2.11.8/bin:/home/tvl/Tools/sbt/bin:/opt/java/jdk1.8.0_74/bin
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
export PATH="$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment