In the dash
shell environment I am looking to split a string into arrays. The following code works in bash
but not in dash
.
IFS=""
var="this is a test|second test|the quick brown fox jumped over the lazy dog"
IFS="|"
test=( $var )
echo ${test[0]}
echo ${test[1]}
echo ${test[2]}
My Question
Does dash
support arrays in this style. If not are there any suggestions for parsing this out into an another type of variable without the use of a loop?