echo -n
my_function() {
echo -n "$@"
}
my_function hello world
I get my desired output:
hello world
printf
my_function() {
printf "$@"
}
my_function hello world
I get only the hello
. Where is the world
?:
hello
Thanks for your help :)
printf
should be a format string, normally containing specifiers like%s
to tell it what to do with the remaining argument(s) - since you haven't provided such, the remaining arguments are ignored and the format string is printed verbatim. – steeldriver Apr 20 '23 at 15:25