LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Need help adding an IF / ELSE statement to my Bash Script (https://www.linuxquestions.org/questions/linux-general-1/need-help-adding-an-if-else-statement-to-my-bash-script-26988/)

Relix 08-01-2002 01:54 PM

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....

naz 08-01-2002 02:03 PM

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


All times are GMT -5. The time now is 07:08 PM.