Quantcast
Channel: FedoraForum.org
Viewing all articles
Browse latest Browse all 36158

printf not working in scripts called from cron

$
0
0
I have a script that prints a list of numbers which sometimes go up to a few Gb. For clarity I use printf %'15d as format (thouand separators). When calling this script from command-line it works as advertised:
Code:

/home/*/.cache/sessions                        9,616
/home/*/.cache                              464,526
/home/*/.local/share/Trash                57,425,266

However when (ana)cron starts it (as root) I do not get thousand separators.

I have been thinking this has to do with the shell under which this runs (printf being a built-in in bash), but (1) the script starts with #!/bin/bash, (2) /bin/sh is anyway a symlink to /bin/bash, (3) no change when I manually set shell=/bin/bash in /etc/anacrontab or /etc/crontab and (4) a printenv in the script confirms it to have bash as shell. Any clues?

Viewing all articles
Browse latest Browse all 36158

Trending Articles