On 2026-04-16 06:21:17 +0200, Harald Dunkel wrote:
>       gate5b# x=$(rcctl ls failed) || rcctl restart $x 
>       smtpd(ok)
>       gate5b# rcctl ls failed                          
>       gate5b# echo $?
>       0
> 
> This is confusing. Imagine grep would exit 1 if it has found
> something.

grep uses inverse logic (positive match) to `rcctl ls failed` (negative
match) so may not be the best analogy. One may want to do something like

  rcctl ls failed || mail ...

to notify from a script but only when there is something to do, that is,
when there is a failed service and therefore a non-zero exit status word
to indicate that.

Reply via email to