read in bash

read is a bash built-in command that reads a line from the standard input (or from the file descriptor) and assigns to variable:

$ read -r var1 var2 var3
hello new delimiter
$ echo $var3 $var2 $var1
delimiter new hello
Changing the delimiter can be done by modifying the variable IFS.
Example 1:
$ IFS=":" read -r var1 var2 var3
hello:new:delimiter
$ echo $var1 $var2 $var3
hello new delimiter
Example 2 - multiple delimiters:
$ IFS="_-" read -r var1 var2 var3
hello-new_delimiter    
$ echo $var1 $var2 $var3
hello new delimiter
To assign the words to an array instead of variable names, invoke the read command with the -a option:
$ read -r -a MY_ARRAY <<< "hello from array"
$ for i in "${MY_ARRAY[@]}"; do echo $i; done;
hello
from
array