I'm trying to split this string and store substrings in separate variables as follows:
temp="one$two$three$fourfive"
IFS="$" read var1 var2 var3 var4 <<< "$temp"
When I echo var1 I get "one" but when I echo var2 there is no output. It works when I add a '\' before every $ sign but when I try to do it programmatically:
echo "$temp" | sed 's/$/\\$/g'
Output: one\$
How can I fix this?