Redirecting stderr to stdout when piping

Paul Howarth paul at city-fan.org
Wed Aug 17 07:37:55 UTC 2005


On Wed, 2005-08-17 at 09:29 +0200, StarQuake wrote:
> I know when redirecting output to a file you can do 2&1> to redirect 
> stderr to stdout. But how would I redirect when want to pipe?
> 
> For example:
> To also let this command mail the error messages:
> #  /usr/bin/php -q -f /var/www/galvatrack/sync/unispeqs2mysql.php | 
> /usr/sbin/sendmail jan at robas.com
> 
> I had to change it like this
> 
> # /usr/bin/php -q -f /var/www/galvatrack/sync/unispeqs2mysql.php &> 
> /var/www/galvatrack/sync/lasttime.log; cat 
> /var/www/galvatrack/sync/lasttime.log | /usr/sbin/sendmail my at address.com
> 
> But that just look horrible

php -q -f /var/..blah../unispeqs2mysql.php 2>&1 | /usr/sbin/sendmail ...

Paul.
-- 
Paul Howarth <paul at city-fan.org>




More information about the fedora-list mailing list