I have the following lines in a BASH script:
ACTIONS_COMMAND="php -f $BASEDIR/scripts/activities.php < \"$SRC_DIR/%s/AndroidManifest.xml\""
printf -v ACTIONS_CMD "$ACTIONS_COMMAND" $FOLDER
$ACTIONS_CMD
This runs inside a loop to do the same operation to several Android applications.
When I echo the $ACTIONS_CMD and copy and paste the command, it produces the correct output, but the script itself starts PHP, but does not copy the STDIN. I know this because PHP hangs until I push Ctrl-D on the keyboard and then it complains there was no input.
I tried switching the PHP command to
ACTIONS_COMMAND="cat \"$SRC_DIR/%s/AndroidManifest.xml\" | php -f $BASEDIR/scripts/activities.php"
When the first file name is in quotes (which I think it should be for safety), I get
cat: "apps/app_name/AndroidManifest.xml": No such file or directory
cat: |: No such file or directory
cat: php: No such file or directory
cat: -f: No such file or directory
<?php
... REST OF PHP SCRIPT ...
and without the quotes, it just outputs to the terminal window.
If it matters, it is GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13).
echojust before the final constructed command to see what is generated and potentially any errors.