The return status is zero if no pattern is matched. Otherwise, the return status is the exit status of the command-list executed. select
The select construct allows the easy generation of menus. It has almost the same syntax as the for command: select name [in words ...]; do commands; done
The list of words following in is expanded, generating a list of items. The set of expanded words is printed on the standard error output stream, each preceded by a number. If the ‘in words’ is omitted, the positional parameters are printed, as if ‘in "$@"’ had been specified. The PS3 prompt is then displayed and a line is read from the standard input. If the line consists of a number corresponding to one of the displayed words, then the value of name is set to that word. If the line is empty, the words and prompt are displayed again. If EOF is read, the select command completes. Any other value read causes name to be set to null. The line read is saved in the variable REPLY.
The commands are executed after each selection until a break command is executed, at which point the select command completes.
Here is an example that allows the user to pick a filename from the current directory, and displays the name and index of the file selected. select fname in *; do echo you picked $fname \($REPLY\) break; done
((...))
(( expression ))
The arithmetic expression is evaluated according to the rules described below
(see Section 6.5 [Shell Arithmetic], page 87). If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. This is exactly equivalent to let "expression"
See Section 4.2 [Bash Builtins], page 48, for a full description of the let builtin.
[[...]]
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the conditional expres- sion expression. Expressions are composed of the primaries described below in
Section 6.4 [Bash Conditional Expressions], page 85. Word splitting and file- name expansion are not performed on the words between the [[ and ]]; tilde expansion, parameter and variable expansion, arithmetic expansion, command substitution, process substitution, and quote removal are performed. Condi- tional operators such as ‘-f’ must be unquoted to be recognized as primaries.
When used with [[, the ‘<’ and ‘>’ operators sort lexicographically using the current locale.