Improving code by using associative arrays

I have the following code, and I am changing it to

#!/bin/bash

hasArgumentCModInfile=0
hasArgumentSrcsInfile=0
hasArgumentRcvsInfile=0

OLDIFS="$IFS"
IFS="|="                # IFS controls splitting. Split on "|" and "=", not whitespace.
set -- $*               # Set the positional parameters to the command line arguments.
IFS="$OLDIFS"

while [ "$#" -gt 0 ]
do

  case "$1" in

  "--"[cC][mM][oO][dD][iI][fF]|\
  "--"[cC][mM][oO][dD]"-"[iI][nN][fF][iI][lL][eE])
    shift
    arg_cmodInfile="${1}"
    hasArgumentCModInfile=1
  ;;

  "--"[sS][rR][cC][sS][iI][fF]|\
  "--"[sS][rR][cC][sS]"-"[iI][nN][fF][iI][lL][eE]|\
  "--"[sS][oO][uU][rR][cC][eE][sS]"-"[iI][nN][fF][iI][lL][eE])
    shift
    arg_srcsInfile="${1}"
    hasArgumentSrcsInfile=1
  ;;

  "--"[rR][cC][vV][sS][iI][fF]|\
  "--"[rR][cC][vV][sS]"-"[iI][nN][fF][iI][lL][eE]|\
  "--"[rR][eE][cC][eE][iI][vV][eE][rR][sS]"-"[iI][nN][fF][iI][lL][eE])
    shift
    arg_rcvsInfile="${1}"
    hasArgumentRcvsInfile=1
  ;;

  *)
    arg_browseDir_fileLst="$arg_browseDir_fileLst ${1}"
    hasArgumentBDirFileLst=1
  ;;

  esac

  shift                 # Skip ahead to the next argument

done

if [ $hasArgumentCModInfile -eq 1 ]; then
  ...
elif  [ $hasArgumentCModInfile -eq 0 ];
  ...
fi

if [ $hasArgumentSrcsInfile -eq 1 ]; then
  ...
elif  [ $hasArgumentSrcsInfile -eq 0 ];
  ...
fi

if [ $hasArgumentRcvsInfile -eq 1 ]; then
  ...
elif  [ $hasArgumentRcvsInfile -eq 0 ];
  ...
fi

Basically I cut out the initializations in the beginning such as

 hasArgumentCModInfile=0
hasArgumentSrcsInfile=0
hasArgumentRcvsInfile=0

Also I would have a common array called hasArgument with the field only filled when the corresponding option is selected.

I want to simplify it using associative arrays for storing the options as follows:

#!/bin/bash

OLDIFS="$IFS"
IFS="|="                # IFS controls splitting. Split on "|" and "=", not whitespace.
set -- $*               # Set the positional parameters to the command line arguments.
IFS="$OLDIFS"

while [ "$#" -gt 0 ]
do

  case "$1" in

  "--"[cC][mM][oO][dD][iI][fF]|\
  "--"[cC][mM][oO][dD]"-"[iI][nN][fF][iI][lL][eE])
    shift
    value[cmodInfile]="${1}"
    hasArgument[cmodInfile]=true
  ;;

  "--"[sS][rR][cC][sS][iI][fF]|\
  "--"[sS][rR][cC][sS]"-"[iI][nN][fF][iI][lL][eE]|\
  "--"[sS][oO][uU][rR][cC][eE][sS]"-"[iI][nN][fF][iI][lL][eE])
    shift
    value[srcsInfile]="${1}"
    hasArgument[srcsInfile]=true
  ;;

  "--"[rR][cC][vV][sS][iI][fF]|\
  "--"[rR][cC][vV][sS]"-"[iI][nN][fF][iI][lL][eE]|\
  "--"[rR][eE][cC][eE][iI][vV][eE][rR][sS]"-"[iI][nN][fF][iI][lL][eE])
    shift
    value[rcvsInfile]="${1}"
    hasArgument[rcvsInfile]=true
  ;;

  *)
    value[bdFileLst]="${value[bdFileLst]} ${1}"
    hasArgument[bdFileLst]=true
  ;;

  esac

  shift                 # Skip ahead to the next argument

done

if ${hasArgument[CModInfile]}; then     # User set value for CModInfile
  ...
elif  ! ${hasArgument[CModInfile]}; then  # User did not select CModInfile option
  ...
fi

if  ${hasArgument[SrcsInfile]}; then
   ...
 elif  ! ${hasArgument[SrcsInfile]}; then
   ...
 fi
 
if $hasArgument[RcvsInfile]}; then
   ...
 elif  ! ${hasArgument[RcvsInfile]}; then
   ...
 fi

I would be very grateful on some comments concerning this scheme, whether it is a good idea or further improvements.

@kristinu
I could be off track because it is hard to follow your code, but have you read up on the Shell getopts command? It is designed to turn command line parameters into Shell variables in an orderly manner.
Just for interest, what is an "associative array" ?

As example,

prog.bash --chmodif=file.cmod

In this case the user has set the cmod file. Then

getopts does not handle long options. Associative arrays let you return different values for different strings, rather than just numbered positions in the array. Associative arrays becomes quite simple like a simple array but instead of an index, one has a string to distinguish elements.

Thank you for your explanation of "associative array". In the context of unix Shell scripting I do not understand it at all ... but in the context of Database Administration I do understand.

Let me leave this thread to those posters who understand what kristinu is trying to achive.

Bye.