Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress error message 1

Status
Not open for further replies.

vrrajeeb

Technical User
Feb 16, 2003
13
0
0
US
Hi,

How to suppress an error message while using shell?

eg)

ll -rt bcopy_1/temp_db_*.sql > bcopy_1/chk.lst
bcopy_1/temp_db_*.sql not found

I don't want the error message "bcopy_1/temp_db_*.sql not found" to appear ... If the file isn't there, it should just create a 0 byte output file (bcopy_1/chk.lst in this case)

How do I do this ? or can I do this ?

Thanx

-Maria
 
You need to redirect standard error to the bit bucket:

ll -rt bcopy_1/temp_db_*.sql > bcopy_1/chk.lst 2> /dev/null

You can create the empty file using touch, but you would need to add a test to check that you're not overwriting a legitimate file.
 
Thanx , it works like a charm !

-Maria
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top