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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to? launch command with string of command line options TinCanFury Shell Programming and Scripting 5 04-28-2008 03:06 PM
AWK - Line length validation en7smb Shell Programming and Scripting 3 05-09-2007 08:04 AM
Please give your inputs !!!! kpatel786 Shell Programming and Scripting 9 04-27-2007 07:59 AM
Vaildation of command line inputs sendhilmani123 Shell Programming and Scripting 6 07-17-2006 05:08 AM
Inputs from a file sendhil Shell Programming and Scripting 4 02-01-2006 02:48 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 05-29-2006
Registered User
 

Join Date: Apr 2006
Posts: 33
Command line inputs validation

Hi,
I have a script called read.sh that takes a file as input. Now I want to make that script take the file as input with a -f option preceding the filename. How can I do this validation. How can I find whether the given option is -f or not inside the script.

Thanks in advance
Reply With Quote
Forum Sponsor
  #2  
Old 05-29-2006
Klashxx's Avatar
HP-UX/Linux/Oracle
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 383
Use getopts
Reply With Quote
  #3  
Old 05-29-2006
Technorati Master
 

Join Date: Mar 2005
Location: Large scale systems...
Posts: 2,610
one more is direct argument validation....

as ,

Code:
if [ $1 = "-f" ]
then
echo "yes"
else
echo "no"
fi
something like that !!!...
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 11:17 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0