I'm looking to modify a script I have to stop it running at a certain time in the day whilst my machine reboots. I've found the following suggestion which seems to fit the bill perfectly but for some reason when I run the script I get no output even though the script contains an echo command.
I modified the script slight as I need it to run everyday at the same time. Thats the only change I made and whether I run it as is in the post or modified I get no output.
#!/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/home/rohtua/scripts if [[ $(date +%H) -eq 19 ]]; then echo "I don't run at this time" exit 1 fi echo "Something to do at other times here..."
My aim is to verify the script will work for me. It would appear to be working as if I run the script with
bash +x test then it works I get the correct response for the time. If I simply run
test however I get no output.
rohtua@rohtuas_pc:~/scripts $ test rohtua@rohtuas_pc:~/scripts $
If someone could explain why I get no output it would be much appreciated. I have other scripts set up including the one I'm looking to ultimately modify to add the timing condition into that use the echo command to announce messages as to progress and they work no issues its just this one for some reason.