recent bash versions reportedly introduced fallthru ;&
and resume ;;&
alternatives to ;;
:
stackoverflow.com/a/24544780/4240261:
Recent
bash
versions allow fall-through by using;&
in stead of;;
: they also allow resuming the case checks by using;;&
there.for n in 4 14 24 34 do echo -n "$n = " case "$n" in 3? ) echo -n thirty- ;;& #resume (to find ?4 later ) "24" ) echo -n twenty- ;& #fallthru "4" | ?4) echo -n four ;;& # resume ( to find teen where needed ) "14" ) echo -n teen esac echo done
sample output
4 = four 14 = fourteen 24 = twenty-four 34 = thirty-four