I'm writing shell(bash) script like this:
output_function()
{
for i in "$@"
do
echo $i
done
}
process_funtion()
{
string=process some thing
output_function $string
}
for example, after process some thing, string is
i am line 1
i am line 2
I want to print these 2 line as it is, but actually I got
i
am
line
1
i
am
line
2
Also this NOT work:
#!/bin/bash
output()
{
printf '%s\n' "$@"
}
output `ifconfig`
result is:
...
2000
inet6
fe80::6de5:743c:addd:7c5a%utun0
prefixlen
64
scopeid
0xa
nd6
options=201<PERFORMNUD,DAD>
And this NOT work also:
#!/bin/bash
output()
{
printf '%s\n' "$*"
}
output `ifconfig`
result is all in one line.
how to fix this? thank you~