mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2234 (markdown)
@@ -1,4 +1,4 @@
|
|||||||
## Remove superfluous `(..)` around test command.
|
## Remove superfluous `(..)` around test command to avoid subshell overhead.
|
||||||
|
|
||||||
### Problematic code:
|
### Problematic code:
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
You are wrapping a single test command in `(..)`, creating an unnecessary subshell. This serves no purpose, but is dramatically slower:
|
You are wrapping a single test command in `(..)`, creating an unnecessary subshell. This serves no purpose, but is significantly slower:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ i=0; time while ( [ "$i" -lt 10000 ] ); do i=$((i+1)); done
|
$ i=0; time while ( [ "$i" -lt 10000 ] ); do i=$((i+1)); done
|
||||||
|
Reference in New Issue
Block a user