So I am testing the following:
foo() {
printf "\nAll the parameters, each on a separate line:\n"
printf "param: %s\n" "$@"
}
foo The "nicely colored" rainbow
The output is:
All the parameters:
param: The
param: nicely colored
param: rainbow
So if I understand correctly because IFS
is set to \t\n
we get the parameters separated by tab (the first char of IFS
).
But why are they printed in separate lines?
Is the printf run for each parameter. I.e. does bash converts this into a
for loop?
Also the following (without double quotes) outputs the same result:
printf "param: %s\n" $@
printf
works. – Barmar Mar 26 '18 at 19:00