How can I reduce the following bash script?
grep -P \"STATUS: (?!Perfect)\" recess.txt && exit 1
exit 0
It seems like I should be able
if anyone gets here looking for a bash return code manipulation:
(grep || exit 0 && exit 123;)
this will return 0
(success) when grep finds nothing, and return 123
(failure) when it does. The parenthesis are in case anyone test it as is on the shell prompt. with parenthesis it will not logout on the exit, but just exit the subshell with the same error code.
i use it for a quick syntax check on js files:
find src/js/ -name \*js -exec node \{\} \; 2>&1 | grep -B 5 SyntaxError || exit 0 && exit 1;