mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Setting IFS=" " does not split if the on two or more spaces, i.e., "var1 var2". While without it, it splits into arr=("var1" "var2")
@@ -28,11 +28,12 @@ If it's a line with multiple words (separated by spaces, other delimiters can be
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# For bash
|
# For bash
|
||||||
IFS=" " read -r -a array <<< "$var"
|
read -r -a array <<< "$var"
|
||||||
|
|
||||||
# For ksh
|
# For ksh
|
||||||
IFS=" " read -r -A array <<< "$var"
|
read -r -A array <<< "$var"
|
||||||
```
|
```
|
||||||
|
1. https://stackoverflow.com/questions/1469849
|
||||||
|
|
||||||
### Rationale:
|
### Rationale:
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user