I am writing a bash script which accept parameters. I am using getopts to achieve it.
#!/bin/bash
while getopts ":a" opt; do
case $opt in
a)
echo "-a was triggered!" >&2
;;
\?)
echo "Invalid option: -$OPTARG" >&2
;;
esac
done
but above code return's me this error.
'etOpts_test.sh: line 4: syntax error near unexpected token `in
'etOpts_test.sh: line 4: ` case $opt in
I am using CentOs 5.5