Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Code Blockexcerpt

Sometimes

we

may

wish

to

take

different

paths

based

upon

a

variable

matching

a

series

of

patterns.

We

could

use

a

series

of

if

and

elif

statements

but

that

would

soon

grow

to

be

unweildly

unwieldily.

Fortunately

there

is

a

case

statement

which

can

make

things

cleaner.

It's

a

little

hard

to

explain

so

here

are

some

examples

to

illustrate:


Code Block
case <variable> in
<pattern 1>)
	<commands>
	;;
<pattern 2>)
	<other commands>
	;;
esac

...