bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More fun with IFS


From: Dan Douglas
Subject: Re: More fun with IFS
Date: Fri, 01 Mar 2013 06:51:13 -0600
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

On Friday, March 01, 2013 11:49:37 AM Thorsten Glaser wrote:
> Dan Douglas dixit:
> 
> >Well, ok then. I'm just nitpicking here. I think this makes sense because
> >distinguishes between $@ and $* when assigning to a scalar, so that the end 
> >result of $@ is always space-separated, as spaces delimit words during
> […]
> >Consider for example if you ever implement "${@@Q}". Because of this
> 
> Hrm, you do have a point there. Now, how to do it for consistency…
> re-reading the manual snippet:
[…]
> This means “"$*"” needs to be “one:::two:three:::four”, and POSIX
> doesn’t say anything about “$*” or address@hidden the manpage says “separate
> words (which are subjected to word splitting)”, so I’d say we need
> “one:::two:three:::four” for “$*” and thus also address@hidden
> 
> So basically, only “"$@"” needs to change to implement what comes
> out of your point, and the other three cases need to stay the same.
> 
> Do you agree?

In the case of $* I don't really care. It's probably going to differ from Bash 
no matter what because as pointed out earlier in this thread, Bash expands 
unquoted $* to multiple words even with a null IFS, whereas mksh doesn't (if 
multiple words result it's from word splitting). “one:::two:three:::four” 
makes sense for the way mksh is doing it.

For "$@" that sounds about right. I think it would be preferable if x="$@" and 
x=$@ were the same. If a user wants IFS-delimited they should probably use 
x=$* because that's what it's for. Even if you decide not to do that, at least 
there will be one way to get that outcome, and people will just have to know 
that $@ behaves like $* when unquoted even in contexts without word splitting.
-- 
Dan Douglas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]