Re: Non-interactive shell and /dev/null
Try KDE wrote:
> I noticed some shell script, for example those under /etc/cron.*/, uses
> "command > /dev/null" style. I think it's because they know the scripts
> is run under non-interactive shell. My question is, what would happen if
> ">/dev/null" is removed and the command tries to print something to
> "standand out" (who knows where it is :) Will that cause real trouble
> or simply leaves mess on some virtual console?
Anything sent to stdout from a cron job will be mailed to the owner of
the cron job (by default, unless the MAILTO environment variable
specifies otherwise). So redirecting to /dev/null is basically a way of
saying, "I don't want this mailed to me, just throw it away."
Craig
Reply to: