User selections

select <NAME>; do
  <LIST>
done
select <NAME> in <WORDS>; do
  <LIST>
done

This compound command provides a kind of menu. The user is prompted with a numbered list of the given words, and is asked to input the index number of the word. If a word was selected, the variable <NAME> is set to this word, and the list <LIST> is executed.

If no in <WORDS> is given, then the positional parameters are taken as words (as if in “$@” was written).

Regardless of the functionality, the number the user entered is saved in the variable REPLY.

syntax/ccmd/user_select.txt (172 views) · Last modified: 2008/06/13 16:11 (external edit)
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0