I'm having trouble turning this program from an if-else statement into a switch statement. Any help would be appreciated.#!/bin/bashfor x in $@do array[$i]=$x i=$((i+1))done# initial statestate=S0for((i=0;i<${#array[@]};i++))doif [ $state == S0 ]   then   if [ ${array[$i]} == I0 ]   then     state=S1     output[$i]=O1   elif [ ${array[$i]} ==  I1 ]   then     state=S0     output[$i]=O0   fielif [ $state == S1 ]  then  if [ ${array[$i]} == I0 ]   then    state=S1    output[$i]=O1  elif [ ${array[$i]} == I1 ]   then    state=S0    output[$i]=O0  fifidoneecho final state=$stateecho output=${output[@]}
Converting an if-else statement into a switch statement
bash;emacs