Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 09-08-2010
Registered User
 

Join Date: Feb 2010
Location: Hawaii
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
if no file then quit

I have a script that run several subscripts. I need to find out how to do two things. First I would like to check for a file and if that file is not there I want to quit the entire script without running the rest of the script which contain subscripts. If the file is there, I want it to continue running.

I would also like to know how to tell it to try again in 1 hour but only up to three times. I already have a script that runs twice daily and just want to insert the script in the existing code.
Sponsored Links
    #2  
Old 09-08-2010
STOIE's Avatar
Registered User
 

Join Date: Jun 2009
Location: Canberra, Australia
Posts: 43
Thanks: 1
Thanked 0 Times in 0 Posts

Code:
if [ ! -f "/my/file" ] ; then
   exit 0;
fi

Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to quit from a script? caro Shell Programming and Scripting 8 01-29-2010 03:54 AM
perl how to exit a while loop and quit reading the input file subhap Shell Programming and Scripting 1 11-04-2009 02:51 AM
detect file size then quit or continue steven99 UNIX for Dummies Questions & Answers 5 01-22-2009 12:32 PM
Script to check for a file, check for 2hrs. then quit mmarsh UNIX for Dummies Questions & Answers 2 09-16-2005 02:46 PM



All times are GMT -4. The time now is 04:12 AM.