I saw codes like this:
fqdn='computer1.daveeddy.com'
IFS=. read hostname domain tld <<< "$fqdn"
echo "$hostname is in $domain.$tld"
# => "computer1 is in daveeddy.com"
I think it works because IFS
is assigned to .
in the third line.. So I tried this:
x=100 echo $x
but found the bash doesn't print anything, while I expect it will print 100
..
Moreover, I found x=100 echo $x; echo $x
print nothing, while x=100; echo $x
prints 100
, which is very confusing.
Does anyone have ideas about this?