From 4e13c7cbc1872a8077490caf63879f60e6e85c7a Mon Sep 17 00:00:00 2001 From: Bastian Bittorf Date: Tue, 10 Jan 2017 12:30:47 +0100 Subject: [PATCH] SC2164: show two possible variants for circumenting the warning always calling 'exit' is not good in e.g. functions. the basic idea is at least that the returncode of cd *is* evaluated somehow and not ignored. Reported-by: Garance Alistair Drosehn Signed-off-by: Bastian Bittorf --- ShellCheck/Analytics.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellCheck/Analytics.hs b/ShellCheck/Analytics.hs index e6fcd8b..f105334 100644 --- a/ShellCheck/Analytics.hs +++ b/ShellCheck/Analytics.hs @@ -2514,7 +2514,7 @@ checkUncheckedCd params root = when(t `isUnqualifiedCommand` "cd" && not (isCdDotDot t) && not (isCondition $ getPath (parentMap params) t)) $ - warn (getId t) 2164 "Use cd ... || exit in case cd fails." + warn (getId t) 2164 "Use 'cd ... || exit' or 'cd ... || return' in case cd fails." checkElement _ = return () isCdDotDot t = oversimplify t == ["cd", ".."] hasSetE = isNothing $ doAnalysis (guard . not . isSetE) root