The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tell me whats wrong with this nadman123 Shell Programming and Scripting 1 04-15-2008 12:58 AM
Whats wrong in this Script ??? varungupta UNIX for Advanced & Expert Users 4 08-31-2007 05:02 AM
Whats wrong with this script? kayarsenal Shell Programming and Scripting 2 08-25-2006 10:58 AM
Whats wrong with this 5 line script! c19h28O2 Shell Programming and Scripting 9 05-11-2006 02:04 AM
whats wrong with this awk??? george_ Shell Programming and Scripting 5 04-04-2006 05:58 AM

Closed Thread
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
  #1 (permalink)  
Old 06-02-2008
nehagupta2008 nehagupta2008 is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 7
Whats wrong in the script?

if [ $1 -eq -* ]
then
if [ $1 = -t ]
then
echo "fst argument is $1 "
else
if [ $1 = -r ]
then
"fst argument is $1"
fi
fi
fi





Can anyone tell me. My requirement is tht pass a string ..
Check whether it contains "-". If yes then check if it contains -r .If -r then put messge else if -t then put some message.
  #2 (permalink)  
Old 06-02-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,285
For this kind of script, you might use "case" or "optargs" instead of lots of if statements. There is various documentation and examples for it on the www. "optargs" is especially for parsing command line parameters.

And please use the code tags because that makes code much more readable.
Closed Thread

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 12:08 AM.


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