I have a string that is read in from a file in the format "firstname lastname". I want to split that string and put it into two separate variables $first
and $last
. What is the easiest way to do this?
read can do the splitting itself, e.g.
read first last < name.txt
echo "$first"
echo "$last"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With