how to use "not in" in case command - bash

Viewed 46

I tried to use "not in" in case command -

#!/bin/bash

VAR="A-1"

case "$VAR" in
        !("^A-.*[0-9]"))
        echo "yes";;
esac

and got this error: Syntax error: "(" unexpected (expecting ")").

I got the same error when I used:

#!/bin/bash

VAR="A-1"

case "$VAR" in
        !(^A-.*[0-9]$)) echo "yes";;
esac
0 Answers
Related