The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-08-2006
james2006 james2006 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 3
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 09:49 AM..
  #2 (permalink)  
Old 06-08-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
Hmm. Homework, huh? Please read the forum rules about homework.
  #3 (permalink)  
Old 06-08-2006
james2006 james2006 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 3
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
james2006 james2006 is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 3
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
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 10:36 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