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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #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!