I am new to this parse argument shell script.
I have created script something like this-
while getopts ":o:s:t:" opt; do
case "$opt" in
o) option=$OPTARG ;;
s) sample=$OPTARG ;;
t) object=$OPTARG ;;
esac
done
#shift $((OPTIND -1))
if [[ $option = 1 ]] || [[ $object -eq TABLE ]]; then
echo "Hello All"
else
if [[ $option = 2 ]] || [[ $object -eq VIEW ]]; then
echo "Hello Me"
fi
fi
Now I am running scrip something like this -
./v4_2.sh -o 1 -s OT - t TABLE
So the output I am getting is -
Hello All
Even if I am running the script with different parameter like this -
./v4_2.sh -o 2 -s OT - t VIEW
Then also I am getting same output that is
Hello All
But, here output I am expecting is - Hello me
Can someone help me like where I am lagging?!
Thanks in advance.