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