Given such situation:
echo "Please enter your name"
read name # user enters: john smith
echo $name # prints: john
What could cause read
to read only the first word of the input?
Is there a shell variable that controls this?
I came across this in a question on Ask Ubuntu and I'm wondering how to reproduce this behavior.
$IFS
or filename generation. Butecho
concats on spaces - and so even for multiple args they should come together. I can imagine if it was an extra quote level deep - like an ssh script or something it might lose some - but that's fuzzy.echo
should at least print the args unless$IFS
is composed of all of the alphabetics or something.printf
, on the other hand, would only print john or 123 in that scenario, though.