I've came to an idea, to completely ditch grep in favor of sed.
Mainly because of this!
And especially, because I simply have a more power, at the hand, with sed.
To my horror, I've figured out that, sed returns exit code 0, upon MATCH and NO_MATCH (grep obeys these)
It will return 0>, only if it receives wrong regex or non existant file.
This makes me unable to use sed in i.e; bourne's 'if' statement
I want to request devs, to extend sed's exit codes functionality, so it could differentiate between MATCH and NO_MATCH, or as sed has functions, which affects matching patterns:
F_APPLIED and F_NOT_APPLIED
Mainly because of this!
And especially, because I simply have a more power, at the hand, with sed.
To my horror, I've figured out that, sed returns exit code 0, upon MATCH and NO_MATCH (grep obeys these)
It will return 0>, only if it receives wrong regex or non existant file.
This makes me unable to use sed in i.e; bourne's 'if' statement
Code:
# Replaces 'grep -Eq ...' -> quiet
if eval "echo \"\$$container\"" | sed -En "/$sep$part$sep/q"; then
echo 'I ALWAYS get executed'
else
echo 'It is sed's fault, I NEVER get executed'
fi
I want to request devs, to extend sed's exit codes functionality, so it could differentiate between MATCH and NO_MATCH, or as sed has functions, which affects matching patterns:
F_APPLIED and F_NOT_APPLIED