
Untitled
By: a guest on
Jun 21st, 2012 | syntax:
None | size: 0.58 KB | hits: 7 | expires: Never
troubles while redirecting stderr in csh
my $out = `cmd`
my $out = `sh -c "cmd 2>&1"`
tcsh$ cmd >& logfile.log
#!/bin/sh
echo stdout
echo STDERR 1>&2
echo tty > /dev/tty
my $out = `sh -c "cmd 2>&1"`;
my $out = `cmd 2>&1`;
% perl -le '$out = `sh -c "grep missing /dev/nowhere 2>&1" | cat -n`; chomp $out; print "got <<<$out>>>"'
got <<< 1 grep: /dev/nowhere: No such file or directory>>>
% perl -le '$out = `grep missing /dev/nowhere 2>&1 | cat -n`; chomp $out; print "got <<<$out>>>"'
got <<< 1 grep: /dev/nowhere: No such file or directory>>>