$ read file
store a string into the variable:
$ read file <<< "This is a string"
retrieve variable value:
$ echo ${file[@]}
create an array of data:
$ read -a file
store data into array:
$ read -a file <<< "This is a test for filling the array"
count elements in array:
$ echo ${#file[@]}
display every element in array:
$ for i in ${file[@]}; do echo $i; done;
fill the array from output redirected from other commands:
$ read file -a file <<<$(cat file.txt)
Watch this
