I have a bash script abcd.sh
#!/bin/sh
for i in `seq 8`; do ssh w$i \'uptime;ps -elf|grep httpd|wc -l;free -m;mpstat\'; done &
pid=$!
sleep 1
ki
It's not easy to understand what you want.
Maybe this helps. The script defines a var PHP_VAR
in bash and use this var in PHP. Then we call a PHP code snippet an put the output in the shell var output
. At last we output the var output
(but you can do something else with it).
Attation: All the output from the PHP will be found in the var output
.
#!/bin/bash
echo "I am a bash echo"
export PHP_VAR="I was in php"
# Here we start php and put the output in 'output'
output=$(php << EOF
EOF
)
# usage var 'output' with php output
echo "---$output---"