#!/bin/bash
# case $variable in
read -p "Enter an animals name: " animal
echo -n "A $animal has "
case $animal in
horse|cow|cat) echo -n "four ";;
man|woman) echo -n "two ";;
*) echo -n "an unknown number of ";;
esac
echo "legs!"
Select
select fname in *;
do
echo you picked $fname \($REPLY\)
break;
done
Type echo * to see how it works
((...))
(( expression ))
[[...]]
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the conditional expression expression.
( expression )
Returns the value of expression. This may be used to override the normal precedence of operators.
! expression
True if expression is false.
expression1 && expression2
True if both expression1 and expression2 are true.
mkdir d && cd d ; pwd
expression1 || expression2
True if either expression1 or expression2 is true.
The && and || operators do not evaluate expression2 if the value of expression1 is sufficient to determine the return value of the entire conditional expression.