Is it possible to use bash to subtract variables containing 24-hour time?
#!/bin/bash
var1="23:30" # 11:30pm
var2="20:00" # 08:00pm
echo "$(expr $var1 - $var2)"
Running it produces the following error.
./test
expr: non-integer argument
I need the output to appear in decimal form, for example:
./test
3.5
bc
orawk
? – Mark Plotnick Dec 24 '18 at 12:39date
to solve this problem. @MarkPlotnick, no constraints, which ever method requires the least code. I'm ready to accept your Answer – user328302 Dec 24 '18 at 12:47