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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to ignore errors (like file not found) ? ? ? ?

Status
Not open for further replies.

czarj

Technical User
Apr 22, 2004
130
US
Hi all,

I have a series of administrative shell scripts that I run to perform a variety of functions (write logs, move files, copy files, execute programs...ect). Currently however, I have a small problem with a few of them not being able to ignore errors.

How do I tell a shell script that if it encounters an error to move on to the next item?

Thanks,

~CzarJ

--- You must not fight too often with one enemy, or you will teach him all your tricks of war.
 
What shell are you using?

Some shells may let you add an option to the hashbang line.

#!/usr/bin/env ksh -i


"If you always do what you've always done, you will always be where you've always been."
 
Be sure you don't have set -e somewhere in your script.
You may also search your script for (b]exit[/b]

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top