Stacking standard output of `su`
- by Kristopher Ives
I've got some code that I wrote that uses a combination of bash and PHP command line scripting. The script is ran as root and then uses su to become various uses. I start a session like this:
$result = `su SomeUser ./dothis.php`
Here ./dothis.php is a script that may generate some output being stored in $result, but the problem is that there is usually output that doesn't get caught and makes it hard for me to read my script output.
How can I make sure that the output is being captured within this su stacking?