lundi 18 février 2019

BASH multiple variable in CASE statement

I have 2 separate case statements

one for AZURE cidr block

 net_prefix=${VNET_CIDR_BLOCK#*/}

    case "$net_prefix" in

    0) azure_wildcard_mask=255.255.255.255
     ;;

    esac

and second for AWS Cidr

aws_net_prefix=${AWS_VPC_CIDR_BLOCK#*/}

case "$aws_net_prefix" in

0) aws_wildcard_mask=255.255.255.255
 ;;
  esac

is it possible somehow to combine above 2 CASE into one. for example

 A=$1

    B=$2

    net_prefix=${A#*/}

    aws_prefix=${B#*/}

    case "$net_prefix" OR "$aws_prefix" in

    0) aws_wildcard_mask=255.255.255.255
       azure_wildcard_mask=255.255.255.255
     ;;

i need both aws_wildcard and azure_wildcard_mask variables

Aucun commentaire:

Enregistrer un commentaire