I have a bash script that contains the following code.
#!/bin/bash
function wait_schedule () {
if [[ ! -z ${1} ]];
then
if [[ ${1} -lt 2400 ]];
then
while [[ $(date +%H%M) -ne ${1} ]];
do
sleep 60
done
else
echo "Error: The requested build time of ${1} is invalid."
exit 1
fi
fi
}
wait_schedule ${1}
echo "Script completed"
When I run it, I get the following output.
[luigi@juventus: ~] ./test.sh
Script completed
[luigi@juventus: ~] date
Thu Feb 13 13:46:03 EST 2020
[luigi@juventus: ~] ./test.sh 1347
Script completed
[luigi@juventus: ~] ./test.sh 2500
Error: The requested build time of 2500 is invalid.
[luigi@juventus: ~] ./test.sh blah
(hangs forever)
How do I verify that the passed argument is actually a number?