|
I don't know why you want first and last in the same string but here's an answer (there are many possible methods).
There are significant benefits to keeping the first and last separate (ie, if the person is a Jr, Sr. III etc) or has a hyphenated name or multiple sirnames...
#!/usr/bin/sh
echo "Enter your full name (i.e. first and last name)"
read name
echo "Hello Mr. `echo $name | awk '{print $NF}'`"
Good luck....
|