On 25/09/17 10:52, Hugo Mills wrote:
Isn't the correct way to catch the return value instead of grepping
the output?
It is, but if, for example, you're using the command in a cron
script which is expected to work, you don't want it producing output
because then you get a mail every time the script runs. So you have to
grep -v on the "success" output to make the successful script silent.
If it's some command not returning value properly, would you please
report it as a bug so we can fix it.
It's not the return value that's problematic (although those used
to be a real mess). It's the fact that a successful run of the command
produces noise on stdout, which most commands don't.
Yes, exactly: cron, mail -E and just long scripts where btrfs operations
are small steps here and there.
(On top of this, actually catching the return value from the right
command before `| grep -v` with errexit and pipefail on is so difficult
that I usually end up rewriting whole mess in Python. Which would be
nice result in itself if it didn't take a whole day in place of one
minute for bash line.)
--
With Best Regards,
Marat Khalili
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html