bug-bash
[Top][All Lists]
Advanced

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

Re: Question on $@ vs $@$@


From: Steffen Nurpmeso
Subject: Re: Question on $@ vs $@$@
Date: Tue, 27 Aug 2024 02:31:16 +0200
User-agent: s-nail v14.9.25-599-g5c75a327b2

Lawrence Velázquez wrote in
 <972ac206-a601-4337-8dfc-77bbaef22b2d@app.fastmail.com>:
 |On Sat, Aug 24, 2024, at 10:08 PM, Steffen Nurpmeso wrote:
 |> One hopefully last thing in this regard for me,
 ...
 |This easily obfuscates the structure of the "$@" expansion.  You'd
 |be better off with something like this, which prints each positional

No, i am not.

  ..
 |Correct.  Since you're using $* unquoted in a context where field
 |splitting is performed, the shell does not expand it to a single
 |field.
 ..
 |POSIX.1-2024 says [2]:
 |
 | *
 |  Expands to the positional parameters, starting from
 |  one, initially producing one field for each positional
 |  parameter that is set.  When the expansion occurs

Thanks for the quote.  *Yes*, i admit i did not reread the
standard text before starting to implement word splitting for the
little MUA i maintain.

 |  in a context where field splitting will be performed,
 |  any empty fields may be discarded and each of the
 |  non-empty fields shall be further split as described
 |  in 2.6.5 Field Splitting.  When the expansion occurs
 |  in a context where field splitting will not be
 |  performed, the initial fields shall be joined to
 |  form a single field with the value of each parameter
 |  separated by the first character of the IFS variable
 |  if IFS contains at least one character, or separated
 |  by a <space> if IFS is unset, or with no separation
 |  if IFS is set to a null string.

Yes, and $* we yet always space separated.  That was a bug.

  ...
 --End of <972ac206-a601-4337-8dfc-77bbaef22b2d@app.fastmail.com>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

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