I have a Bash script which installs a customized JBoss. The name of the JBoss instance is checked against a regular expression to make sure that the name is valid:
if [[ ! $1 =~ $instanceNameRegex ]]; then exit 1 fi
We now have a requirement for a second valid regex. ie the name must match either
How do I achieve this in the
if test? I'm looking for this, but I can't get it to work:
if [[ [ ! $1 =~ $instanceNameRegex ] -a [ ! $1 =~ $secondInstanceNameRegex ] ]]; then
ie if the parameter doesn't match the first regex AND it doesn't match the second, then exit.