David?

Ced

On 10 January 2013 23:06, Cedric Blancher
<[email protected]> wrote:
> David, do you have any idea why ksh93 doesn't use POSIX order in the
> example below?
>
> Ced
>
> ---------- Forwarded message ----------
> From: Dan Douglas <[email protected]>
> Date: 9 January 2013 20:00
> Subject: Reverse redirection / assignment order
> To: [email protected]
>
>
> When expanding simple commands, steps 3 and 4 are reversed unconditionally for
> all command types and number of words expanded, even in POSIX mode.
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01
>
> The exceptions allowed by POSIX appear to only apply to ksh93. Other shells
> always use the POSIX order, except Bash, which never uses the POSIX order,
> though the manpage description is the same as POSIX.
>
>     #!/usr/bin/env bash
>
>     # 1) no command expanded, 2) special builtin, 3) regular builtin.
>     tst() {
>         "$sh" -c 'x=$(printf 2 >&2) ${1+"$1"} <&0$(printf 1 >&2)' _ "$@"
>     } 2>&1
>
>     for sh in {,{b,d}a,po,{,m}k,z}sh bb; do
>         printf '%-4s: %s %s %s\n' "$sh" "$(tst)" "$(tst :)" "$(tst true)"
>     done
>
> Out:
> sh  : 21 21 21 # bash posix mode
> bash: 21 21 21 # normal mode
> ksh : 21 21 12 # ksh93 is the other oddball shell
> dash: 12 12 12 # ...
> ...            # Everything else same as dash
>
> I don't know why this order was chosen or what the advantages to one over the
> other might be.
> --
> Dan Douglas
>
>
> --
> Cedric Blancher <[email protected]>
> Institute Pasteur

Cedric Blancher <[email protected]>
Institute Pasteur
_______________________________________________
ast-developers mailing list
[email protected]
http://lists.research.att.com/mailman/listinfo/ast-developers

Reply via email to