I was about to embark on writing a bash script (as a bash newbie). The purpose of the script is to be enforce the requirement that some other commands (i.e. the work part of the script) dosen’t run on holidays.
I found the snippet below online:
#!/bin/bash
grep -i date holiday.txt
if[ $? -ne 0] then;
#script to run the jobs
exit
fi
Although I admit I am a bash neophyte, I can’t seem to spot anything wrong with this script – yet at the same time, it looks a little too “simplistic” – are there any “gotchas” that my untrained eye cannot spot now, but will come to bite me in the rear later on?
I am running GNU bash, version 4.1.5(1)-release
example of holiday.txt