I want to create a crontab entry for it. So the solution has to be a one liner as I do not want to write a script and then invoke that script in crontab (with full if else inside a script-file, I can do this easily).
But I want to use some &&
or ||
to achieve something like:
cmd1 | cmd2 | cmd3 | wc -l != 0? mail -s "Found xyz" ...
Is that possible ?
CodePudding user response:
Try this:
test "$(unreadable | long | list | of | commands | in | one | line)" && mail -s ...
It is useless to count the lines, if you just want to know, if the commands produce any output.