From 448233b88105817a322d711ea6432964a0a211ec Mon Sep 17 00:00:00 2001 From: koalaman Date: Sat, 15 Aug 2015 14:07:13 -0700 Subject: [PATCH] Updated SC2103 (markdown) --- SC2103.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SC2103.md b/SC2103.md index c3bf107..ce18cc3 100644 --- a/SC2103.md +++ b/SC2103.md @@ -1,4 +1,4 @@ -# Consider using ( subshell ), 'cd foo||exit', or pushd/popd instead. +# Use a ( subshell ) to avoid having to cd back. ### Problematic code: @@ -24,7 +24,7 @@ or for dir in */ do - cd "$dir" || continue + cd "$dir" || exit convert index.png index.jpg cd .. done @@ -39,4 +39,4 @@ Check `cd`s exit status and/or use subshells to limit the effects of `cd`. ### Exceptions -None known. \ No newline at end of file +If you set variables you can't use a subshell. In that case, you should definitely check the exit status of `cd`, which will also silence this suggestion. \ No newline at end of file