HI there!
I\'ve run into some problem while learning to combine .sh files and PHP. I\'ve create a file test.sh and in that file I call a PHP file called test.php.
<
It is possible that your environment is different when launching from the Terminal and when launching via a double-click. Try executing which php
and echo $PATH
from the Terminal to see what the deal is.
EDIT 1
As others have noted, if your "command not found" is referring to the shell script and not php, then you probably forgot to include the "./" before the name of the script (i.e. ./test.sh
). Also, don't forget to make it executable by invoking chmod a+x test.sh
. The reason for this is that PATH does not include the current directory (i.e. "."), because doing so would be a security risk (e.g. folders with a ton of files in them including a fake "ssh" which could then intercept your password or the like).
EDIT 2
Also, I don't know about you, but ${0/%cli/}
is evaluating to -bash
from within my Terminal. Are you sure that's what you wanted it to expand to? Perhaps you should specify the exact filename.