I have a Bash script which should only execute in a specific time window (from midnight to 00:15 AM). But if I execute the function, I get [: too many arguments as an error message. How do I solve it? I still want to use Bash. I'm using Ubuntu Server 20.04 LTS.
Script:
currTime=`date +%H%M` check_time_to_run() { tempTime=$1 if [ $tempTime -gt 0150 -a $tempTime -lt 0015 ]; then echo "Time is after 0 AM and before 0:10 AM. Restarting Server." else echo "Time is not between 0 AM and 0:15 AM. Aborting restart." exit 1 fi }