case in Mac OS X

By: Strauss K  

Expand words, and match against patern.

Syntax
      case word in [ [(] pattern [ | pattern ] ... ) list ;; ] ... esac

A case command first expands word, and tries to match it against each pattern in turn, using the same matching rules as for pathname expansion (see Pathname Expansion).

The word is expanded using tilde expansion, parameter and variable expansion, arithmetic substitution, command substitution, process substitution and quote removal.

Each pattern examined is expanded using tilde expansion, parameter and variable expansion, arithmetic substitution, command substitution, and process substitution. If the shell option nocasematch is enabled, the match is performed without regard to the case of alphabetic characters.

When a match is found, the corresponding list is executed. After the first match, no subsequent matches are attempted.

The exit status is zero if no pattern matches. Otherwise, it is the exit status of the last command executed in list.

case is a bash builtin command




Archived Comments

1. thank you.
View Tutorial          By: lluulnw at 2014-11-22 12:39:35

2. Thanks for the sharing.
View Tutorial          By: royal1688 download at 2014-11-22 12:36:23


Most Viewed Articles (in macos )

Latest Articles (in macos)

Comment on this tutorial