Skip to content

fortune | cowsay should be silent in not interactive shells

Several references advice to avoid human messages output in a non interactive shell. For instance this post says:

It's best if there's no output to stdout from login rc files such as ~/.bash_profile or ~/.profile since it can interfere with the proper operation of rsync for example.

Or this one:

Non-interactive: the shell is probably run from an automated process so it can't assume it can request input or that someone will see the output. E.g., maybe it is best to write output to a log file.

Scripts in /etc/profile.d are executed either in interactive or non-interactive shells.

In our hestia CP instances we are having a chatterbox cow who speaks in hestia commands and sends annoying empty notifications.

cielito.system.motd scripts should output fortune | cowsay only in interactive shells.