From a9ba1dafde8b15df6febe7df534eafe5b9adc835 Mon Sep 17 00:00:00 2001 From: Vasili Novikov Date: Tue, 11 Jan 2022 08:23:05 +0100 Subject: [PATCH] quick fix to reduce the number of logical negations, double meaning of "foo" and improve readability --- SC2155.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SC2155.md b/SC2155.md index 4b1ef7f..db4763b 100644 --- a/SC2155.md +++ b/SC2155.md @@ -50,9 +50,9 @@ foo=$(mycmd) The exit status of the command is overridden by the exit status of the creation of the local variable. For example: ```bash -$ f() { local foo=$(false) || echo foo; }; f -$ f() { local foo; foo=$(false) || echo foo; }; f -foo +$ f() { local foo=$(false) && echo "silent error happened"; }; f +silent error happened +$ f() { local foo; foo=$(false) && echo "silent error happened"; }; f ``` ### Problematic code in the case of `readonly`: