On 04/02/15 18:44, Bruce Korb wrote: > True. It was mostly a plea for some (findable) documentation. > In truth, my most common usage is more like: > > touch -t $(date --date@$(( $(stat -c %Y file1) + 10 )) > +%Y%m%d%H%M.%S ) file2
Note +%Y%m%d%H%M.%S is ambiguous on distributed systems (no timezone). If you're using GNU date, then it's reasonable to assume GNU touch, in which case you can: touch file2 --ref=file1 --date='+10 seconds' Or you can reference the file itself like: touch file --ref=file --date='-10 seconds' As for generating unambiguous time representations, you can use more abstract output formats like: for fmt in --rfc-2822 --iso-8601=seconds --rfc-3339=seconds; do date $fmt; done Wed, 04 Feb 2015 18:13:07 +0000 2015-02-04T18:13:07+0000 2015-02-04 18:13:07+00:00 Also more abstract input formats can provide advantages. For example relative dates like "last month" etc. could be context sensitive (though they currently are not). For example the following could work no matter what time it was: touch --date='yesterday' cheers, Pádraig.