Need explanation for the syntax


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need explanation for the syntax
# 1  
Old 03-21-2007
CPU & Memory Need explanation for the syntax

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

Last edited by chandhar; 03-21-2007 at 09:12 AM..
# 2  
Old 03-21-2007
Run this script in verbose mode.

In Korn shell,
Assuming your script is test.ksh, Run this as
Quote:
ksh -vx test.ksh
or Add
Quote:
set -vx
in the script and try
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need explanation

Hi, I need more explination on it, how it works abcd="$(echo "$abcd" | sed 's/ //g')" >> ${LOGFILE} 2>&1 can any one suggest me on this? Rgds, LKR (1 Reply)
Discussion started by: lakshmanraok
1 Replies

2. UNIX for Dummies Questions & Answers

Filesystem explanation

Hey everyone, I just need some clarification on a filesystem question that's been bothering me. When checking df- k (output below) you can see the root filesystem, usr, var, and the disks they are mounted to at the top of the list. However below there appears to be another root filesystem... (2 Replies)
Discussion started by: blinkme323
2 Replies

3. Shell Programming and Scripting

Explanation Needed

Hi all, I'm very new to UNIX. I have got a coding, where i dont understand the below part. Could someone please explain it in detail? awk 'NR > 1; NR == 1 { S = $0 } END { print S }' $textfile.bak > $textfile could someone explain what awk 'NR > 1; NR == 1 { S = $0 } END { print S }' ... (1 Reply)
Discussion started by: raghulshekar
1 Replies

4. UNIX for Dummies Questions & Answers

In need of explanation

Its great someone provided this script that strips out a filename and extension but can someone explain how each line works? file1='Jane Mid Doe.txt' newfile='Jane.txt' 1) ext=${file1##*.} 2) filename=${file%%.???} 3) set -- $filename 4) newfile="1.$extension" (1 Reply)
Discussion started by: Lillyt
1 Replies

5. UNIX and Linux Applications

need explanation

Hi am having a c pgm. It has the include files (unistd.h,sys/types.h,win.h,scr.h,curses.h,stdarg.h and color.h). I don't know the purpose of these include files. will u plz explain me. (1 Reply)
Discussion started by: Mari.kb
1 Replies

6. Shell Programming and Scripting

tr explanation please

how does below tr command replace nonletters with newlines? I think I understand tr -cs '\n' part.. but what is A-Za-z\' <--- what is this?? tr -cs A-Za-z\' '\n' | -c --complement -s, --squeeze-repeats replace each input sequence of a repeated character that is... (1 Reply)
Discussion started by: convenientstore
1 Replies

7. Shell Programming and Scripting

tr explanation please

how does below tr command replace nonletters with newlines? I think I understand tr -cs '\n' part.. but what is A-Za-z\' <--- what is this?? tr -cs A-Za-z\' '\n' | -c --complement -s, --squeeze-repeats replace each input sequence of a repeated character that is... (0 Replies)
Discussion started by: convenientstore
0 Replies

8. Shell Programming and Scripting

explanation for the syntax

Hi I am new to shell programming, can anyone explain me the following syntax... it could be helpful if it was brief... if (1 Reply)
Discussion started by: chandhar
1 Replies

9. Shell Programming and Scripting

Need explanation for the syntax(code)

Hi I am new to shell script programming... want to know the process of the following: if then echo "$0: missing argument for option(s) :$MISSINGOPTARG" echo "usage" $USAGE" exit 1 fi (1 Reply)
Discussion started by: chandhar
1 Replies

10. Shell Programming and Scripting

ksh syntax explanation - from mimetool

Hi I got this part of the script from the mimetool by Perderabo. I have difficulty in decyphering the syntax specially lines 4,5 & 9. Also the test condition in line 3. Could someone help me on this please. -------------------------------------- pwentry=$(grep "^$(logname):" /etc/paswd)... (2 Replies)
Discussion started by: chaandana
2 Replies
Login or Register to Ask a Question