Trying to split a string into two variables

This is a bug in Bash 4.2. See chepner’s answer for a proper explanation. It is about quotes. Use: IFS=’:’ read var1 var2 <<< “$var” ^ ^ instead of IFS=’:’ read var1 var2 <<< $var See result: $ IFS=’:’ read var1 var2 <<< “$var” $ echo “var1=$var1, var2=$var2” var1=hello, var2=world But $ IFS=’:’ read var1 … Read more