These shell functions are the ones I find most useful. There are others among the Other Systems.


A generic yes/no asker that takes a question string. Returns true or false. Optionally returns a default.


A generic question asker. Takes a question, an optional default answer, and, optionally, a list of valid replies. Returns the validated answer on stdout.


A wrapper for the shell 'select' command. Takes the name of an array containing the options. Adds a leading 'Quit' option. Returns the string 'idx=<number>' to be 'eval'd to set the variable 'idx' to the index of the chosen element. returns the string 'exit' with a return code of 1 if 'Quit' is chosen. Displays a title if the variable 'title' is set. It is very easy to produce complex hierarchical menus with this.


Works like 'sel', except that it returns strings that can be 'set -A' into an array.