![]() |
csh suppress output; newbie question
This is a simple question, but it's giving me problems...
I have: :
if( -e $HOME/*.core ) thenHow can I suppress the output from the rm command? Thanks in advance. |
redirect STDERR
apparently in csh there is no standard way to do it, but there are ways.. http://www.codecomments.com/Unix_Pro...age452517.html |
I should've mentioned that I tried that, first.
:
if( -e $HOME/*.core ) then/home/<user>/*.core: no match :( And, from man rm(1): -f Attempt to remove the files without prompting for confirma- tion, regardless of the file's permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. The -f option overrides any previous -i options. So it shouldn't echo stderr anyway, should it? Also, redirecting both stderr and stdout (which I was trying to do incorrectly in the first example) doesn't help, either: :
if( -e $HOME/*.core ) thenthe 'else' never gets a chance... I'll try again without any redirection... No dice. Same result. Also, from the command line (csh) rm displays the same behavior. JoloK |
sorry, I was thinking ksh.
I editied my post what you want is, >& also yes, It looks like with -f there should be no error msg to worry about. Maybe I should've left this one to someone with more knowledge...... |
Okay the -f does suppress the error message.
The :
/home/<user>/*.core: no match:
(-e $HOME/*.core) |
Ah! Ok, I was orginally trying different test variables there... I'll work on it from that angle. Thanks, spydoor!
JoloK |
Here's a nasty solution.... There must be much better ways
count the number of files that match *.core... ignore 'No match'... (to be correct you would also have to ignore other find error msgs like Permission denied.....) :
if(`find $HOME/*.core |& grep -v 'No match' | wc -l`) then |
| All times are GMT -5. The time now is 3:44 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC