Below is the shell script using getopts
#!/bin/bash
while getopts "USER:PWD:JOBID:PROJECTID:" flag
do
case "${flag}" in
USER) TEST_USER=${OPTARG};;
PWD) TEST_PWD=${OPTARG};;
JOBID) TEST_JOBID=${OPTARG};;
PROJECTID) TEST_PROJECTID=${OPTARG};;
esac
done
echo "USER: $TEST_USER";
echo "PWD: $TEST_PWD";
echo "JOBID: $TEST_JOBID";
echo "PROJECTID: $TEST_PROJECTID";
Continue of script i have not put here and if above commands work fine then my issue solve
And Here what im running output in terminal, Which one is a correct way to get output command
./getopts.sh -USER=devops@gmail.com -PWD=xxxxxx -JOBID=8a809e2496 -PROJECTID=80e2ea54b231f
OR
./getopts.sh USER=devops@gmail.com PWD=xxxxxx JOBID=8a809e2496 PROJECTID=80e2ea54b231f
After running above command im getting empty response or string USER: PWD: JOBID: PROJECTID: