I have a bash script where I want to pass a variable into a PHP script, the PHP script will execute and return something which should be stored in a bash variable. My bash script code is like so
ip="192.168.1.4"
version=`/usr/bin/php checkVer.php $ip`
So in these two lines of code, I want to pass $ip as a variable to the checkVer.php script and then the script will execute some code, return something, and that return will be stored in the bash variable version. However, version= is only returning the $ip variable. Why is this?
Here is the PHP script
$ip = $argv[1];
if ($ip == "192.168.1.4") {
return true;
}
However, the bash variable version
is not storing true
it is storing the ip address