printf white space issue word splitting
I am having trouble keeping the name together and the phone number together, I think due to the white space. I have tryed "" and '' it doesn' seem to matter. So it may be my syntax? and does it matter how long the first and last names are.
me$ echo 'fstname lstname' '123 123-1234' | ./myscript
read a b
printf "%-15s %20s\n" $a $b >> my_phone_numbers
fstname lstname 123 123-1234
i know its not an elegant script but im still learning how some commands work
thanks to the people who help on this site it has helped many times in the past
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.
thanks again for all the help, That did the trick
|All times are GMT -5. The time now is 11:51 PM.|