How to preserve trailing whitespace in bash function arguments? [duplicate]
What happened to the trailing whitespace in the first argument?
The whitespace was included on the
echo
command line, but was discarded by the shell, the same as if you had typed:echo -n Testing... ^ |----- there is a space here
How can preserve it?
Quote your variables:
function foo { echo -n "$1" echo "$2"}