I found that the code in question is for ksh
and not bash
. For getopts
we can't use long options. I ended up manually parsing arguments as below
while test -n "$1"; do
case "$1" in
-c|--mode)
mode=$2
shift 2
;;
-d|--file1)
file1=$2
shift 2
;;
-e|--file2)
file2=$2
shift 2
;;
esac
done