mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2103 (markdown)
@@ -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.
|
||||
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.
|
Reference in New Issue
Block a user