Computing.Net > Forums > Unix > Supressing error message

Supressing error message

Reply to Message Icon

Original Message
Name: moh_hak_786
Date: June 28, 2007 at 01:48:51 Pacific
Subject: Supressing error message
OS: Unix
CPU/Ram: AIX
Comment:

when I fire 'ls' for file 'moh' which is not present.
getting error message on output
"ls: 0653-341 The file moh does not exist."
how to supress out this message from being displayed when file do not exist


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: June 28, 2007 at 08:52:42 Pacific
Subject: Supressing error message
Reply: (edit)

Unix commands write to either stdout or stderr. You can send stderr to a file

ls 2> errfile moh

or to /dev/null

ls 2> /dev/null moh

Another method is turning stderr off:

ls 2>&- moh


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Supressing error message

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software