In the script I'm working on the user defines a variable labeled start time. I would like to increment and decrement that variable by ±3 hrs. The format is 00:00:00 (24hr) and I'm uncertain if there is a better way that doesn't involve string manipulation because if it is less than zero I can't pass -03:00:00 to the Python script that utilizes this variable.
#somescript.sh 00:01:35
STARTTIME=$1
E=${STARTTIME%*:}
S=${STARTTIME##*:} && ((S=S+3)
echo "$S : $E"
Desired Result: 03:01:35 and 21:01:35
Reviewed: String Operators and Incrementing time (minutes and seconds) in bash / shell script prior to asking this question. Any assistance would be appreciated.