# Need explanation for the syntax

**URL:** <https://community.unix.com/t/need-explanation-for-the-syntax/169937>\
**Category:** Shell Programming and Scripting\
**Created:** [March 21, 2007, 7:33am UTC](https://community.unix.com/t/need-explanation-for-the-syntax/169937 "2007-03-21T07:33:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chandhar](https://community.unix.com/letter_avatar/chandhar/32/5_5575768a8748004e209b776fc1b2916d.png) [@chandhar](https://community.unix.com/u/chandhar)\
**Post date:** [March 21, 2007, 7:33am UTC](https://community.unix.com/t/need-explanation-for-the-syntax/169937/1 "2007-03-21T07:33:06Z")

</div>

Hi it will be very useful for me if anyone gives step by step explanation for the below code:

USAGE="check -S dbserver [-D dbname] [-U userid]  
where  
-S dbserver specifies name of database server  
-D dbname specifies name of database on database server  
-U userid specifies name of user for database"

while getopts ":S:D:U:" OPTION "$@"  
do  
case $OPTION in  
S) SRVR=$OPTARG;;  
D) DB="$OPTARG"; USEDB="use $OPTARG";;  
U) UID=$OPTARG;;  
🙂 MISSINGOPTARG="$MISSINGOPTARG -$OPTARG";;  
?) if ["$OPTARG" = "?"]  
then  
HELP=1  
else  
UNEXPECTEDOPT="$UNEXPECTEDOPT -$OPTARG";  
fi;;  
esac  
done

---

<div class="post-metadata">

**Author:** ![ennstate](https://community.unix.com/user_avatar/community.unix.com/ennstate/32/514_2.png) [@ennstate](https://community.unix.com/u/ennstate)\
**Post date:** [March 21, 2007, 3:31pm UTC](https://community.unix.com/t/need-explanation-for-the-syntax/169937/2 "2007-03-21T15:31:16Z")

</div>

In Korn shell,  
Assuming your script is test.ksh, Run this as

> [@](#):
>
> ksh -vx test.ksh

or Add

> [@](#):
>
> set -vx

in the script and try
