I have the following logic in my bash script:
#!/bin/bash
local_time=$(date +%H%M)
if (( ( local_time > 1430 && local_time < 2230 ) || ( local_ti
One may be forced to keep the variable as it is for a variety of reasons (e.g. file naming issues). If this is the case, solve the issue within the conditional test by explicitly specifying base 10#
:
#!/bin/bash
local_time=$(date +%H%M)
if (( ( 10#${local_time} > 1430 && 10#${local_time} < 2230 ) || ( 10#${local_time} > 0300 && 10#${local_time} < 0430 ) )); then
# do something
fi