Re: select w.o. ENTER
Ray Andrews <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <[email protected]> |
On 2026-05-06 11:01, Mark J. Reed wrote:
> That's just not how select(1) works. If you want a menu that lets the
> user respond with a keypress, you need to roll your own.
I figured it would be doable but I didn't suspect it would be this easy:
>
> chosen=0
> while (( chosen < 1 || chosen >$#path )); do
> for (( i=1; i<$#path; ++i)); do
> printf '%d) %s\n' "$i" "${path[i]}"
> done
> printf '%s' "$PS3"
> read -k chosen
> done
> pith=$path[$chosen]
>
>
... mind, pressing ENTER isn't exactly difficult.
Thanks Mark