402 B
402 B
categories | tags | ||
---|---|---|---|
|
|
Case statements in Bash
function convertCharToInt {
case $1 in
A | X )
echo 1
;;
B | Y )
echo 2
;;
C | Z )
echo 3
;;
*)
echo 0
;;
esac
}
Usage:
declare -i intValue = $(convertCharToInt B)