Resposta atualizada
touch -r filename -d '+8 days' filename
Do info coreutils touch invocation
(obrigado @don_crissti):
'-r FILE'
'--reference=FILE'
Use the times of the reference FILE instead of the current time. If this option is combined with the '--date=TIME' ('-d TIME') option, the reference FILE's time is the origin for any relative TIMEs given, but is otherwise ignored. For example, '-r foo -d '-5 seconds'' specifies a time stamp equal to five seconds before the corresponding time stamp for 'foo'. If FILE is a symbolic link, the reference timestamp is taken from the target of the symlink, unless '-h' was also in effect.
Se você quiser expansão de variáveis, você pode usar aspas suaves ao redor do argumento -d
da forma como é.
DAYS=8
touch -r filename -d "+${DAYS} days" filename
Amostra:
$ ls -l foo.bar
-rw-r--r-- 1 usr usr 69414810 Nov 10 2016 foo.bar
$ TEST=100
$ touch -r foo.bar -d "+${TEST} days" foo.bar
$ ls -l foo.bar
-rw-r--r-- 1 usr usr 69414810 Feb 24 2017 foo.bar