Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
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.


  Search this Thread
Old 08-01-2002, 02:54 PM   #1
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 02:55 PM.
Old 08-01-2002, 03:03 PM   #2
Registered: Aug 2002
Location: Malaysia
Distribution: RedHat
Posts: 58

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


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 02:05 PM
how to close 'else' statement block in bash script servnov Linux - General 9 11-12-2004 04:53 PM
Adding directories to the PATH statement kaplan71 Slackware 2 09-02-2004 04:57 PM
Bash script problems with "if" statement adz Programming 2 05-22-2004 04:34 AM
bash script for adding multiple users pilipk01 Linux - Newbie 4 01-12-2004 11:05 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:44 AM.

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