The need for quoting on the command line is a separate issue from the word splitting done inside the script. They're necessary to keep the input strings together when sending the values to the script, but they're not part of the input itself.
Inside the script you have to reapply the quotes wherever you need the spaces to be seen as part of the string, around variable references in particular.
Code:
read a b
printf "%-15s %20s\n" "$a" "$b" >> my_phone_numbers
Edit: I just noticed that there's a second issue here as well. The quotes in the input line only protect the input long enough to pass the values to echo; then it's echo that pipes them into the script. This means that the spaces are NOT protected when they hit read. You can check it yourself:
Code:
read a b
echo "a is $a"
echo "b is $b"
printf "%-15s %20s\n" "$a" "$b" >> my_phone_numbers
...and the output:
Code:
$ echo 'fstname lstname' '123 123-1234' | ./myscript
a is fstname
b is lstname 123 123-1234
firstname lastname 123 123-1234
The only way I know to overcome that, as long as you use echo and a pipe, is to escape the spaces in order to protect them from echo.
Code:
$ echo -e "fstname\ lstname" "123\ 123-1234" | ./myscript
a is fstname lstname
b is 123 123-1234
firstname lastname 123 123-1234