Just a Cron test command to consider, create an empty file in the user's home directory every minute:
* * * * * touch ${HOME}/example.example
Will touch behave the same in all systems (overriding an existing file)?
Have you ever came across a Linux in which touch will not override a file but rather create versions such as filename(1)
, file_name(2)
, etc. ?
$HOME
is not quoted (and cron jobs are run by sh by default where an unquoted parameter expansion invokes split+glob). But otherwise, theHOME
environment variable is meant to be set in cron jobs to the home directory of the owner of the crontab. So usingtouch ~/example.example
ortouch "$HOME/example.example"
should be fine. – Stéphane Chazelas Nov 23 '21 at 13:16