mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Change x5 more incidents of word "linefeed" for word "newline," as code reflects.
@@ -32,7 +32,7 @@ $ printf '<%s>\n' "$var"
|
|||||||
or
|
or
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Literal, quoted linefeed
|
# Literal, quoted newline
|
||||||
$ line="foo
|
$ line="foo
|
||||||
> bar"
|
> bar"
|
||||||
$ printf '<%s>\n' "$line"
|
$ printf '<%s>\n' "$line"
|
||||||
@@ -43,7 +43,7 @@ bar>
|
|||||||
or
|
or
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Linefeed using ANSI-C quoting
|
# Newline using ANSI-C quoting
|
||||||
$ line=$'foo\nbar'
|
$ line=$'foo\nbar'
|
||||||
$ printf '<%s>\n' "$line"
|
$ printf '<%s>\n' "$line"
|
||||||
<foo
|
<foo
|
||||||
@@ -53,9 +53,9 @@ bar>
|
|||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
ShellCheck has found a `\t`, `\n` or `\r` in a context where they just become regular letters `t`, `n` or `r`. Most likely, it was intended as a tab, linefeed or carriage return.
|
ShellCheck has found a `\t`, `\n` or `\r` in a context where they just become regular letters `t`, `n` or `r`. Most likely, it was intended as a tab, newline or carriage return.
|
||||||
|
|
||||||
To generate such characters (plus other less common ones including `\a`, `\f` and octal escapes) , use `printf` as in the example. The exception is for linefeeds that would be stripped by command substitution; in these cases, use a literal quoted linefeed instead.
|
To generate such characters (plus other less common ones including `\a`, `\f` and octal escapes) , use `printf` as in the example. The exception is for newliness that would be stripped by command substitution; in these cases, use a literal quoted newline instead.
|
||||||
|
|
||||||
Other characters like `\z` generate a [[SC1001]] info message, as the intent is less certain.
|
Other characters like `\z` generate a [[SC1001]] info message, as the intent is less certain.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user