Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: minor 'select' snag



On Feb 15, 12:05am, Martijn Dekker wrote:
}
} If a user presses Ctrl-D (EOF) within a 'select' loop, the REPLY
} variable is left unchanged on zsh. On the other shells with 'select', it
} is cleared, which is the same behaviour as 'read' (including 'read' on
} zsh) and seems more logical.

There are several other differenced of "select" from "read".  For example
zsh's "select" will accept a maximum of 256 bytes of input, doesn't do
any special handling of multibyte characters, won't allow a line to be
continued with a backslash, etc.  In bash,

    select foo in a b c; do loopbody; done

seems to be equivalent to

    while read "?$PS3"; do
     case $REPLY in (1) foo=a;; (2) foo=b;; (3) foo=c;; (*) foo="";; esac
     loopbody
    done

Zsh also prints an extra newline after the select is done.



Messages sorted by: Reverse Date, Date, Thread, Author