mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2118 (markdown)
26
SC2118.md
Normal file
26
SC2118.md
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
## Ksh does not support `|&`. Use `2>&1 |`
|
||||||
|
|
||||||
|
### Problematic code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/usr/bin/ksh
|
||||||
|
make |& tee ~/log
|
||||||
|
```
|
||||||
|
|
||||||
|
### Correct code:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/usr/bin/ksh
|
||||||
|
make 2>&1 | tee ~/log
|
||||||
|
```
|
||||||
|
### Rationale:
|
||||||
|
|
||||||
|
You are using the Bash specific shorthand `|&`, but your script is running with Ksh. Rewrite it to its full, POSIX-compatible form as shown in the example.
|
||||||
|
|
||||||
|
### Exceptions:
|
||||||
|
|
||||||
|
None
|
||||||
|
|
||||||
|
### Related resources:
|
||||||
|
|
||||||
|
* Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc!
|
Reference in New Issue
Block a user