Could someone till me what this calculation really means
let foo=`date "+(1%H-106)*60+1%M-100"` bar=foo+1440
Could someone till me what this calculation really means
let foo=`date "+(1%H-106)*60+1%M-100"` bar=foo+1440
Freddie,
The above command just substitutes current hour o/p in place of %H & current minute o/p in place of %M. Eg: If current time is 09:49, your statement will be something like this.
(109-106)*60+149-100
If you want value of this expression, you can pass this to bc command like
echo $foo | bc
-Nithin.
what if I wanted the date yesterday (5/10) 6:00 AM through the prev day of 5/9 6:00 AM? how would you code that?
The script as posted calculates the time 18 hours in the future expressed as minutes since the start of today.
i.e. 24x60=1440 (number of hours in the day)
The script subtracts 6 hours from the current time then adds the 24 hours. Nett 18 hours.
@freddie99 Don't understand your latest question. Can you give examples.
@bsnithin The script does the calculation already.
Thanks! you explained how the calculation works so I should be able to do on my own now. awesome! thanks everyone!!!