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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.