URL: <https://savannah.gnu.org/support/?111102>
Summary: ksh93 oddity w.r.t. ${1+"$@"} on AIX (for section
"Portable Shell"?)
Group: Autoconf
Submitter: None
Submitted: Fri 02 Aug 2024 03:16:59 PM UTC
Priority: 5 - Unprioritized
Severity: 3 - Normal
Status: None
Privacy: Public
Assigned to: None
Originator Email: [email protected]
Open/Closed: Open
Discussion Lock: Any
Operating System: None
_______________________________________________________
Follow-up Comments:
-------------------------------------------------------
Date: Fri 02 Aug 2024 03:16:59 PM UTC By: Anonymous
I know you already recommend not to use ${1+"$@"} in section "Portable Shell"
-> "Shell Substitutions" of the info manual.
Here might be another reason why: Certain ksh version on AIX drop trailing
empty arguments when expanding ${1+"$@"}. Like this:
$ uname -a
AIX host 2 7 00F7BD2A4C00
$ echo ${.sh.version}
Version M 93t+ 2009-05-01
$ set x foo bar baz ""
$ shift 1
$ echo $#
4
$ set x ${1+"$@"}
$ shift 1
$ echo $#
3
$ echo ":$1:$2:$3:"
:foo:bar:baz:
When using regular "$@" things work as expected:
$ set x foo bar baz ""
$ shift 1
$ echo $#
4
$ set x "$@"
$ shift 1
$ echo $#
4
Probably worth mentioning in the info manual?
Thanks!
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/support/?111102>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
