On Sat, 28 Dec 2002 02:55:44 +0530, you wrote:

>I tried a simple command line script, in all cases no_file does not exist. I
>do not want the command line script to show the error on the screen but to
>deliver it in the variable $r. But alas, in all 3 cases i get 'rm: canoot
>remove `no_file': No such file or directory'
[script snipped]

I think this is because your error is being sent to stderr but PHP is
only capturing what is sent to stdout.  I was able to acheive your
desired results by redirecting stderr to stdout via the shell.  Try
the following, it worked for me:

#! /usr/bin/php -q
<?
$r = `rm no_file 2>&1`;
echo "the value in r is $r";
?>

If you need more info on the "2>&1" part, consult the Advanced Bash
Scripting Guide here:

http://www.digitaltoad.net/docs/guide/advshell/io-redirection.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to