mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
The "read" command in ksh for arrays takes upper-case -A param; otherwise the command is identical to the bash version.
@@ -27,8 +27,11 @@ printf '%s\n' "$var" | while IFS="" read -r line; do array+=("$line"); done
|
||||
If it's a line with multiple words (separated by spaces, other delimiters can be chosen with IFS), [each of which should be an element](https://stackoverflow.com/a/30212526):
|
||||
|
||||
```sh
|
||||
# For bash and ksh
|
||||
# For bash
|
||||
IFS=" " read -r -a array <<< "$var"
|
||||
|
||||
# For ksh
|
||||
IFS=" " read -r -A array <<< "$var"
|
||||
```
|
||||
|
||||
### Rationale:
|
||||
|
Reference in New Issue
Block a user