On Tue, Mar 27, 2012 at 7:31 AM, Greg Wooledge
<address@hidden> wrote:
Because the substitution is performed on each *individual* parameter,
before concatenating them.
Thank You. I just found that in man bash.
You also should not use == inside a [ command. That is a bashism, and
you will get a syntax error in sh. For that matter, // substitution is
also a bashism. If you're going to use bashisms, you should go whole hog
and use the [[ and (( commands.
That's part of my issue with bash documentation. There's nothing in it that says such and such is deprecated in favor of something else. It gives a few different ways of doing things and I picked one way. Now I learn I picked wrong 12 years ago and have thousands of lines of bash script code running on hundreds of servers. The fact that sh might object is unimportant to me as in 12 years I never made use of it.
I'll take your suggestion and make the changes to modernize the scripts and functions.
Oh, but it does:
imadev:~$ set -- '' '' ''
imadev:~$ IFS=''
imadev:~$ echo "<$*>"
<>
imadev:~$ unset IFS
imadev:~$
That works on my end as well, but I still don't understand why the following doesn't work:
set -- '' '' ''
IFS='' echo "IFS=''->${*}<-"
yields
IFS=''-> <-
My understanding is that setting IFS this way is a one statement temporary change to IFS good only for the duration of that statement. But it doesn't appear to work.
What am I missing?