Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #12134

Re: ${1+"$@"} does not generate multiple words if IFS is empty

Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!weretis.net!feeder6.news.weretis.net!news.glorb.com!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: ${1+"$@"} does not generate multiple words if IFS is empty
Date Wed, 30 Dec 2015 08:00:15 -0500
Lines 24
Approved bug-bash@gnu.org
Message-ID <mailman.1346.1451480452.843.bug-bash@gnu.org> (permalink)
References <56835243.0Dp3As7Vk0rP8qDy%martijn@inlv.org> <87io3gtiku.fsf@igel.home>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1451480453 31289 208.118.235.17 (30 Dec 2015 13:00:53 GMT)
X-Complaints-To action@cs.stanford.edu
Cc martijn@inlv.org, bug-bash@gnu.org
To Andreas Schwab <schwab@linux-m68k.org>
Envelope-to bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <87io3gtiku.fsf@igel.home>
User-Agent Mutt/1.4.2.3i
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.14
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:12134

Show key headers only | View raw


On Wed, Dec 30, 2015 at 10:02:41AM +0100, Andreas Schwab wrote:
> martijn@inlv.org writes:
> 
> > 	The substitution ${1+"$@"} should resolve to "$@" if there is at
> > 	least one parameter -- i.e. one word per parameter. This works fine
> > 	if IFS contains any character or is unset. If IFS is empty, it
> > 	instead resolves to the equivalent of "$*", i.e. a single word
> > 	concatenating all the parameters without a separator. IFS should
> > 	not influence the behaviour of "$@" under any circumstances.
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_05
> 
> "If the value of IFS is null, no field splitting shall be performed."

By itself that doesn't explain it.  But if you scroll up to
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_05_02
it says:

  @
  Expands to the positional parameters, starting from one. When the
  expansion occurs within double-quotes, and where field splitting (see
  Field Splitting) is performed, each positional parameter shall expand
  as a separate field [...]

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: ${1+"$@"} does not generate multiple words if IFS is empty Greg Wooledge <wooledg@eeg.ccf.org> - 2015-12-30 08:00 -0500

csiph-web