when using read, the following problems are encountered, which are not consistent with what you think. The code and results are as follows
-sharp!/bin/bash
IFS=" " read -d "-" var1 var2 <<< " 123 -"
printf "%s\n" "var1=$var1= var2=$var2="
IFS="|" read -d "-" bar1 bar2 <<< "|123|-"
printf "%s\n" "bar1=$bar1= bar2=$bar2="
my expected result should be
var1== var2=123=
bar1== bar2=123=
but the actual result is this
var1=123= var2==
bar1== bar2=123=
my question, for the first test example, since I specified the delimiter of IFS as""space, why isn"t var1 empty?