bash: let exp ? exp : exp problem
Hello, I am trying to get a bash script to work which will hibernate
till 1:00 am, it appears to work OK
# ensure script executes next at 1:00am
let _mintoone=(1440-($(date '+%H')*60+$(date '+%M')))+60
if [ $_mintoone -gt 1440 ] ; then
let _mintoone=$_mintoone-1440
fi
sleep $_mintoone'm'
However "info let" seems to say that it has a condensed version of
if...then...., ie
expr ? expr : expr
conditional expression
So I tried it in various forms ...
let $_mintoone -gt 1440:_mintoone=$_mintoone-1440
but none work. Am I reading the help screen correct ? If so how does the
syntax work ?
The info on this help screen is a little light.
Many thanks
Dave
PS bash is addictive ...
PPS I am not using cron since the script uses xmessage and executed via
cron causes xhost access problems, just in case you were wondering ....
Reply to: