On Jan 28, 9:46 pm, r...@kuicr.kyoto-u.ac.jp (Raymond Wan) wrote: > Hi, > > inetquestionwrote: > > for the example perl script below is there a way to avoid errors from > > showing up in stdout if the shell script being called does not exist? > > The shell script being called is not in the same directory as the perl > > script, but is in the path. Otherwise I would just do a check to see > > if it exist before calling it. redirecting the output to /dev/null > > doesn't seem to work. > > > #!/usr/bin/perl > > > `sm_timeline.sh $0 "socket usage" 2>/dev/null`; > > print "hello\n"; > > So, if you want to check to see if the file exists, then you just use the > appropriate file test from here: > > http://perldoc.perl.org/functions/-X.html > > If you want to redirect stdout to /dev/null, then you will need: > "1>/dev/null". "2" is stderr. If you want both going to /dev/null, then: > > 1>/dev/null 2>&1 > > would send stderr to the same place you sent stdout. > > Was this what you were looking for? > > Ray
yes, that works on unix. The problem with testing for the file is the path is not necessarilly known, but is located in the path so referencing it by name only works if that case. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/