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
ksh: cmd output to input of another script IMTheNachoMan Shell Programming and Scripting 2 04-27-2008 09:58 AM
log script input and output using tee ? moseschrist Shell Programming and Scripting 0 11-12-2006 03:32 AM
Giving input to a script through a script radhika03 Shell Programming and Scripting 7 08-18-2005 03:17 AM
command line paramaters edog UNIX for Dummies Questions & Answers 1 01-15-2002 11:40 AM
Reading Input in a Script alwayslearningunix UNIX for Dummies Questions & Answers 2 03-30-2001 12:48 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-30-2007
KenLynch KenLynch is offline
Registered User
  
 

Join Date: Jan 2007
Location: Dublin, Ireland
Posts: 15
Script Input Paramaters

I'm trying to write a simple script to send e-mails using ksh on a Sun Solaris box.

The script is as follows:

# Arguments: $1 = Command Type i.e. mailx etc
# $2 = Subject
# $3 = From
# $4 = To
# $5 = Mail File
#
# IF MAIL TYPE IS mailx THEN DO:
#
if [ "$1" = "mailx" ]
then
mailx -s $2 -r $3 $4 < $5
fi


The problem is this. The subject input paramater i.e. $2 can be a full sentence i.e. "Test E-Mail". So how do I get a ksh script to read in a sentence and see it as a single input paramater and not multiple paramaters.

This script is being run from within a 4GL program and the input paramaters are being passed in from DB fields.

Is there a unix replace command I could use. I thought about passing the subject in as follows "Test_E-Mail" and the perhaps replacing the underscore "_" with a space " ".

Is that possible?

Cheers!
  #2 (permalink)  
Old 05-30-2007
ennstate ennstate is offline
Registered User
  
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Hi,
You can provide the subject within double quote ".

Example:

cat arg.ksh
Code:
#!/bin/ksh
echo $1 $2 $3 $4 $5
Code:
./arg.ksh mailx "Test Email" a@b.com d@e.com File
Code:
Output :
  mailx Test Email a@b.com d@e.com File
Does this answers your query.

Thanks
Nagarajan G
  #3 (permalink)  
Old 05-30-2007
KenLynch KenLynch is offline
Registered User
  
 

Join Date: Jan 2007
Location: Dublin, Ireland
Posts: 15
Thanks ...

Actually I had just figured that out myself. If I use single quotes from the 4GL and then change the mailx part of the script to take in literal double quotes it works fine.

Cheers again,

Slainte.
Sponsored Links
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 08:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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