It looks like you’re trying to get the date in a timezone that is 24 hours ahead of EST. I’m not sure why you’d want to do that, but I don’t think I’d expect the result to be a time two days ago.
I think the intent of the + and – values in the TZ variable are to manually specify a real timezone relative to UTC, and the range would be between -12 and +14.
I’m not sure what you’re trying to accomplish with your calculation unless TZ is being manipulated prior to this line of code.
1. TZ is set to the string “EST5EDT”. It means you are in the Eastern time zone, 5 hours offset from UTC/GMT and you observe Daylight Savings when you are in that part of the calendar. Portions of Indiana that don’t observe DST would use a different string.
2. `TZ=$TZ+24` returns null.
3. `date +%Y%m%d` is the standard date command with formatting information. Note the + is required for specifying format.
Yes, but if you have a variable assignment before a command (date), then the variable assignment takes effect just for that command. So he’s trying to append +24 to the timezone when he runs the date command. I think he’s trying to get yesterday’s date.
This is probably a more reliable way of doing the same thing: