LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-01-2002, 01:54 PM   #1
Relix
LQ Newbie
 
Registered: Aug 2002
Location: Alabama
Distribution: FreeBSD 4.6-RELEASE
Posts: 7

Rep: Reputation: 0
Unhappy Need help adding an IF / ELSE statement to my Bash Script


i have a bash script that cron runs every hour to strip certain text from a file, and send it to me via email every hour, then deletes the file. it works fine, but somtimes another file hasnt been written yet, so i recive an email with a null message. i want to add an IF/Else statement to this script so if there is no file present, it wont send the message... the Advanced Bash Shell Script how-to hasnt been much help.... i would appreciate any feedback....

Last edited by Relix; 08-01-2002 at 01:55 PM.
 
Old 08-01-2002, 02:03 PM   #2
naz
Member
 
Registered: Aug 2002
Location: Malaysia
Distribution: RedHat
Posts: 58

Rep: Reputation: 15
if [ -f /path/to/file ]; then
#file exists - so do stuff
fi
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a rotating - to my bash script Cinematography Programming 3 08-31-2005 01:05 PM
how to close 'else' statement block in bash script servnov Linux - General 9 11-12-2004 03:53 PM
Adding directories to the PATH statement kaplan71 Slackware 2 09-02-2004 03:57 PM
Bash script problems with "if" statement adz Programming 2 05-22-2004 03:34 AM
bash script for adding multiple users pilipk01 Linux - Newbie 4 01-12-2004 10:05 PM


All times are GMT -5. The time now is 07:49 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration