16 lines
395 B
Bash
Executable File
16 lines
395 B
Bash
Executable File
#!/bin/sh
|
|
[ "$#" -lt "1" ] && {
|
|
echo "Configure current shell to use a specific major PHP version.
|
|
|
|
Usage: usephp 7"
|
|
exit 0
|
|
}
|
|
binary="php${1}"
|
|
wanted="/usr/bin/${binary}"
|
|
[ ! -f "${wanted}" ] && {
|
|
echo "'${binary}' not found. Using 'php'."
|
|
wanted="/usr/bin/php"
|
|
}
|
|
ln -sf "${wanted}" "${HOME}/bin/php"
|
|
inUse=$(php -nr "echo phpversion();")
|
|
echo "Shell configured to use PHP ${inUse}." |