As rici says , dashes do not support array. However, there are workarounds if you want to write a loop.
There will be no arrays for the loop, but you can do the splitting using the while + read builtin loop. Since the built-in dash reader also does not support delimiters, you also have to get by.
Here's an example script:
myArray="abcd" echo $myArray | tr ' ' '\n' | while read item; do
This will be equivalent to bash code:
myArray=(abcd) for item in ${myArray[@]}; do echo $item done
If you want to get the nth element (say 2nd for example purposes):
myArray="abcd" echo $myArray | cut -d\ -f2
source share