How can I run another command if there is any input on the standard input
commonly used in situations like this:
some command with no normal output | ifinput mail -s 'some output' me
|
How can I run another command if there is any input on the standard input commonly used in situations like this: some command with no normal output | ifinput mail -s 'some output' me
| |||
|
feedback
|
|
The simplest solution would be using a file (if you dare!).
The
Edit: the comment below by glenn jackman contains even a better solution. | |||||
feedback
|
|
A little trickery with
| |||||
feedback
|
|
You could also create a shell script. That script could first call some command that redirects the output to a file and then call the mail command from within the script to send it out which is essentially what SamKrieg is doing without the need to create a shell script. A reason for the script may depend on if you want to run this command as a cron job or somehting. | |||
|
feedback
|