mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 11:19:45 +08:00
printf for bash also does not have an extended format with placeholder for each argument
@@ -21,7 +21,7 @@ echo $n
|
||||
In `sh`, temporary files, FIFOs or file descriptors can be used instead. When the output of the command can be stored to a variable before entering the loop, here documents are a preferable alternative:
|
||||
```sh
|
||||
n=0
|
||||
SUMMANDS="$(printf '%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n' 1 2 3 4 5 6 7 8 9 10)"
|
||||
SUMMANDS="$(printf '%s\n' 1 2 3 4 5 6 7 8 9 10)"
|
||||
while read i; do n=$(( n + i )); done <<SUMMANDS_INPUT
|
||||
$SUMMANDS
|
||||
SUMMANDS_INPUT
|
||||
|
Reference in New Issue
Block a user