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
parameters jaay Shell Programming and Scripting 4 04-14-2008 01:10 AM
sed and parameters scotty_123 Shell Programming and Scripting 7 03-26-2007 01:22 AM
Max NO of parameters Shivdatta Shell Programming and Scripting 1 07-24-2006 05:11 AM
parameters aekaramg20 Shell Programming and Scripting 6 07-10-2006 10:15 PM
tar parameters kmar UNIX for Advanced & Expert Users 4 10-23-2001 12:03 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-08-2006
Registered User
 

Join Date: Jun 2006
Posts: 3
Stumble this Post!
Unhappy Need Parameters Help.

I can test for one parameter but anything more then that and I get an Error.

I forgot I run this batch in a shell
#!/bin/sh
-------------------------------------------------------------------------

Write a batch program that accepts a keyword as a parameter and finds all the files containing that keyword. Display the lines found and the number of hits.

Adjust the batch program to accept 1, 2 or 3 parameters.

If 1 parameter exists, we may assume we are looking for the word supplied.

If 2 parameters exist, we are looking for files having both keywords.


(this is harder)
If 3 parameters exist, test the second one for the values
and
or
-v
and search accordingly. These are the only values accepted as the second parameter when 3 parameters are present.



Anyhelp would be greatly appreciated.
Thank You
James

Last edited by james2006; 06-08-2006 at 06:49 AM.
Forum Sponsor
  #2 (permalink)  
Old 06-08-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,795
Stumble this Post!
Hmm. Homework, huh? Please read the forum rules about homework.
  #3 (permalink)  
Old 06-08-2006
Registered User
 

Join Date: Jun 2006
Posts: 3
Stumble this Post!
I am not asking for anyone to do this for me just some help with passing the parameters.

this is how I am testing them.
if test $#=3
then
Grep Command
elif test $#=2
then
Grep Command
elif test $#=1
then
Grep Command.
else echo no parameter was inputted.

Yes it is for homework But I have seen many input questions in a way to mask that it is their homework. I came right out and posted it without trying to hide the fact that it is for my homework.
All I am doing is asking for direction nothing more.
  #4 (permalink)  
Old 06-08-2006
Registered User
 

Join Date: Jun 2006
Posts: 3
Stumble this Post!
Unhappy

I just noticed that we cannot post this.

I am sorry

Mod please lock this thread, as I was unaware I could not ask for direction with my homework.

Sorry Again
James
Google The UNIX and Linux Forums
Closed Thread

Thread Tools
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0