I have some bash scripts that I would like to run in OSX, but some of them contain the fallthrough case terminator ‘;&’ which doesn’t seem to work on Mac. Here’s sample code:
#!/bin/bash
case $1 in
test)
echo "go" ;&
test)
echo "go2" ;;
esac
In Cygwin, .\test.sh test produces
go
go2
but on OSX,
./test.sh: line 4: syntax error near unexpected token `&'
./test.sh: line 4: ` echo "go" ;&
Your code works as is on my ubuntu system, bash 4.2.24.
I think you are using an earlier version of bash which doesn’t support
;&fall-through which was added since bash 4.From wikipedia: