I'm trying to create a bash command in which you enter a number between 1 and 12 and it is using the switch command but in the bash shell the case command. I just need to make sure I have the right idea going for this or if i'm completley off
#!/bin/bash
1="January"
2="February"
3="March"
4="April"
5="May"
6="June"
7="July"
8="August"
9="September"
10="October"
11="November"
12="December"
case "1" in
print "$1"
case "2" in
print "$2"
case "3" in
print "$3"
case "4" in
print "$4"
case "5" in
print "$5"
case "6" in
print "$6"
case "7" in
print "$7"
case "8" in
print "$8"
case "9" in
print "$9"
case "10" in
print "$10"
case "11" in
print "$11"
case "12" in
print "$12"
echo "Please enter a number 1 through 12"
read input_variable
echo "$input_variable"
1=Januaryisn't a valid variable assignment, either. If you wanted to set$1through$12, you'd run:set -- January February March April May June July August September October November December.declare -a months=( January February ...etc... ); read -r input_variable; echo "${months[$(( input_variable - 1))}". Acasestatement is overkill for this use.echo "${months[input_variable-1]}"