I'm trying to make a simple TCSH script that effectively emulates find and outputs to a file; in addition I want to eliminate any error messages sent to Standard Error.
#!/bin/tcsh
ls $argv > filelist 2> /dev/null
The find portion of the script seems to work as should, but the Standard Error redirect doesn't. What's the best way to "eliminate" error messages?
The syntax you tried is bashy. In tcsh, you can do:
(ls $argv > filelist) >& /dev/null
Note that >& redirects both stdout and stderr, but since stdout has already been redirected elsewhere only the stderr will make it through to /dev/null.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With