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

minor 'select' snag



I'm analysing the behaviour of 'select' in various shells and found a a
way in which it's different in zsh from bash, ksh93 and {pd,m}ksh.

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. This makes it possible to decide whether to
continue after the loop by testing for the emptiness of $REPLY without
having to initialise it before entering the loop. It would be nice if
this worked the same way on zsh.

Thanks,

- M.

(Note of possible side interest: My experimental cross-platform shell
library, "modernish" <http://github.com/modernish/modernish> has a
module providing its own 'select' implementation for POSIX shells. It
mimics native implementations as closely as possible. On bash, *ksh and
zsh, the module does nothing except a check for a particular shell bug.
End result: all POSIX shells can use 'select'. There are just some minor
differences to account for, including the above-mentioned one.)



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