crontab: using ${USER}

I am writing some scripts that uses ${USER} to point to subsequent scripts. But when I run it from crontab, it errors out and the files are not found. I understand why.

I intend to share this with my colleagues and each time the colleague has to manually change the first line to his own username. How can I minimize this issue (not have a manual way to change that one line)?


Solution 1:

It's a typo. You should use $USER, not ${USER}.

Cron parses these lines itself and does only simple variable substitution; it is not a shell.