The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using getopts TurboArkhan Shell Programming and Scripting 3 06-22-2009 05:31 PM
getopts question k2k Shell Programming and Scripting 2 06-26-2008 10:05 PM
getopts question!!! andy2000 Shell Programming and Scripting 1 03-27-2007 01:15 AM
question about getopts ahtat99 Shell Programming and Scripting 2 08-20-2006 02:45 PM
help in getopts problems Shell Programming and Scripting 1 05-05-2006 12:07 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-05-2009
rookieuxixsa rookieuxixsa is offline
Registered User
  
 

Join Date: Dec 2008
Location: NYC
Posts: 8
getopts question

I am trying to set up prompts when you don't enter the right information or dont enter the information at all, when executing a script. Below is the question that i am asking and i am not sure how to set up the if statements to make sure that the user enters the name, cpu's, memory and ip. I was told that getopts with a cease statement might be usefull, but im not sure how to apply it. Any help would be greatly appreciated...

NAME=$1
NCPUS=$2
MEMORY=$3
IP=$4
MACHINENAME=`hostname`
MASTERHOST=svvnyc702

echo "Do you wish to proceed with the creation of UAT ZONE zone-${NAME}, CPU's ${NCPUS}, MEMORY ${MEMORY}, IP ${IP}
<y or n> ? \c"

read WISH
echo
if [ $WISH = "n" ] ; then
echo "You chose no, good bye"
exit
fi
if [ ! $WISH = "y" ] ; then
echo in vaild optin g - exiting
exit
fi
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0