Updated SC2039 (markdown)

Mingye Wang
2020-05-28 22:45:41 +08:00
parent bb05dc3811
commit e241394e82

@@ -227,7 +227,6 @@ reuse_quote()(
reuse_quote "$@"
```
### `jobs` flags
The only acceptable flags under POSIX sh for `jobs` are `-l` and `-p` ([see spec](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/jobs.html)). Common flags supported by other shells are `-s` and `-r`, to check for stopped/suspended jobs and running jobs. A portable alternative is using `grep` or `awk`:
@@ -251,20 +250,6 @@ command > file 2>&1 or command 2>&1 | othercommand
No Comments / Exceptions
### Heredoc
Change:
```
sed 's/some_replacement//g' <<< "${var}"
```
To:
```
printf '%s' "${var}" | sed 's/some_replacement//g'
```
No Comments / Exceptions
### Prefixing signal names with `SIG`
Instead of e.g.:
@@ -275,10 +260,14 @@ trap my_handler SIGTERM
use:
```sh
trap my_handler TERM
# or (`trap -l` for a list of signal numbers):
# or (`trap -l` for a list of signal numbers; not every one is portable!)
trap my_handler 15
```
## Exception
Depends on what your expected POSIX shell providers would use.
Some features have POSIX proposals:
* `local`: https://www.austingroupbugs.net/bug_view_page.php?bug_id=767
* `$'c-style-escape'`: see above