mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Updated SC2176 (markdown)
@@ -3,7 +3,8 @@
|
|||||||
### Problematic code:
|
### Problematic code:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
time foo | bar```
|
time foo | bar
|
||||||
|
```
|
||||||
|
|
||||||
### Correct code:
|
### Correct code:
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ To time everything in a pipeline:
|
|||||||
time bash -c 'foo | bar'
|
time bash -c 'foo | bar'
|
||||||
```
|
```
|
||||||
|
|
||||||
Note that you can not `time sh -c` to time an entire pipeline, because POSIX does not guarantee that anything other than the last stage is waited on and therefore be recursively counted in the `times()` call that `time` depends on.
|
Note that you can not use `time sh -c` to time an entire pipeline, because POSIX does not guarantee that anything other than the last stage is waited upon by the shell.
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
@@ -27,4 +28,4 @@ This behavior is explicitly left undefined [in POSIX](http://pubs.opengroup.org/
|
|||||||
|
|
||||||
### Exceptions:
|
### Exceptions:
|
||||||
|
|
||||||
None. This method is not given in `ksh` or `bash` where `time` is defined for pipelines.
|
None. This warning is not emitted in `ksh` or `bash` where `time` is defined for pipelines.
|
Reference in New Issue
Block a user