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
Problem with script not able to take parameters passed to it dsravan Shell Programming and Scripting 3 02-28-2008 05:09 PM
Problem with script not able to take parameters passed to it dsravan Shell Programming and Scripting 7 10-09-2007 10:28 PM
Assigning a Variable all the Parameters passed samit_9999 UNIX for Dummies Questions & Answers 2 12-04-2006 05:21 PM
variable passed to awk whatisthis UNIX for Dummies Questions & Answers 3 09-15-2004 02:41 PM
variable passed to awk whatisthis UNIX for Dummies Questions & Answers 8 09-15-2004 01:48 PM

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 05-22-2007
spookyrtd99
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
Question Extracting passed in parameters

we want to produce a script that we can pass parameters of -a for email address and -s for subject then the report filename, so an exmaple would be;
email_report -a sendto@domain.com -s This is a test reportname.txt

The problem we have is the subject can have more than one word, so I can't just get the next para after the -s. What I need to do is maybe place the subject in quotes so I can extract from the starting to the ending quote?
Then how do I get the filename, as it 's the last parameter?
  #2 (permalink)  
Old 05-22-2007
jgt jgt is offline
Registered User
  
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 452
Write the script so that the report is standard input, then the command would be:
email-report -a mail@address -s "This is your report" <report filename
If the report is the entire body of the email, then:
mail -s "this is your report" mail@address <report-filename
  #3 (permalink)  
Old 05-22-2007
spookyrtd99
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
I got around this by formatting the script as;
email_report -a email@address <reportname> -s "subject goes in here"

so I grab the -a param
the next parm is the report name
the rest is the subject
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 05:23 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