On Mon, 22 Mar 2004 bryan@ak.net wrote:
> By gosh, you're right. I didn't know that.
> As for why it didn't work for eddie, I'll step back into the
> shadows until my next flash of insight. :)
;-) Apparently I don't know squat, either, you were right. I would have
never thought to suggest that fix.
I'm going over that POSIX.2 spec again, maybe I read too much into that
paragraph (it talks about the command substitution, but not specifically about
substitution as part of variable assignment). A few paragraphs later it says:
... If a command substitution occurs inside double-quotes, field
splitting and pathname expansion shall not be performed on the results of
the substitution.
That would seem to infer that the output would be subject to field splitting,
which I thought I already knew, i.e.:
acorliss@bifrost:~/test$ touch foo bar
acorliss@bifrost:~/test$ ls -l
total 0
-rw-r--r-- 1 acorliss corliss 0 Mar 22 23:33 bar
-rw-r--r-- 1 acorliss corliss 0 Mar 22 23:33 foo
acorliss@bifrost:~/test$ for file in `ls` ; do echo $file ; done
bar
foo
acorliss@bifrost:~/test$ for file in "`ls`" ; do echo $file ; done
bar foo
For some reason I just didn't think it applied to variable assignment, but,
then, that's pretty much what the loop is doing, so, who knows, I was probably
smoking the spec instead of reading it when that got lodged in my
brain-housing. :-P
What's ironic, then, is that the POSIX shell on FreeBSD, the Korne shell on
AIX, and the Bash on my Linux distro all exhibit the same bug.
--Arthur Corliss
Bolverk's Lair -- http://arthur.corlissfamily.org/
Digital Mages -- http://www.digitalmages.com/
"Live Free or Die, the Only Way to Live" -- NH State Motto
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Mon Mar 22 23:36:54 2004
This archive was generated by hypermail 2.1.8 : Mon Mar 22 2004 - 23:36:54 AKST