Script Input Paramaters


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Input Paramaters
# 1  
Old 05-30-2007
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  
Old 05-30-2007
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  
Old 05-30-2007
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help OS X script : password input

Hello Sorry for the question.. i would like to make a script for OS X that allow me to change the password for a user account. i have to use this script on several iMac with the same user/password. i want to store the passwords inside the script, no security problems involved. the... (9 Replies)
Discussion started by: araan87
9 Replies

2. UNIX for Beginners Questions & Answers

Passing input to script using another script

I need a script to pass the input to another script. eg: I need a script to provide input to the sample script becuase my input value are constant. $./sample.sh PLease provide the comment:<input> date:<date> select the option:<1/2> (2 Replies)
Discussion started by: bkiran2020
2 Replies

3. Shell Programming and Scripting

Script needs input always

Dear All, I have a sever configured as a Netbackup Master server from where I manually expire tapes. I use the following command to expire a tape: sudo /usr/openv/netbackup/bin/admincmd/bpexpdate -m A00362 -d 0 Once I hit enter , it prompts me for a y or n: sudo... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies

4. Shell Programming and Scripting

Input in expect script

Hi, i have one problem with this script: ------------------------------- cat hostid_gathering #!/bin/bash cat /home/user1/ip_switch | while read LINE; do echo $LINE /home/user1/expect_script2 done ------------------------------ cat /home/user1/expect_script2 #!/usr/bin/expect... (6 Replies)
Discussion started by: elilmal
6 Replies

5. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

6. Shell Programming and Scripting

Need script to take input from file, match on it in file 2 and input data

All, I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then Insert file1 column2 to file2 column4 then create a new file. File1: 12345 Sam 12346 Bob 12347 Bill File2:... (1 Reply)
Discussion started by: darkoth
1 Replies

7. Shell Programming and Scripting

passing paramaters to a pl\sql precedure

I have this piece code in a shl, I need to pass paramaters to a PL\SQL PRECEDURE like $fseqno and faidy I know that the $fseqno works correctly but I am not sure aboyt the faidy can I code it like that faidy ='0910' ? Thank you for i in 3526*.dat do # Capture just the file... (1 Reply)
Discussion started by: rechever
1 Replies

8. Shell Programming and Scripting

Input to shell script

Hi, I have 10 database instances runnning in one unix box. To connect to each database..i have to set the environment. I am trying to write a shell script to set my environment for database by just tying the oracle instance name After logging into the unix machine... i want to type the... (3 Replies)
Discussion started by: castlerock
3 Replies

9. Shell Programming and Scripting

Giving input to a script through a script

/home/adw/a.ksh << EOF a b EOF This is how we give input to a file through script Our client has done the coding in a different way :- /home/adw/a.ksh << ** a b Can nybody pls tell me the significance of ** (7 Replies)
Discussion started by: radhika03
7 Replies

10. UNIX for Dummies Questions & Answers

command line paramaters

how do you get the 10... element from a command line arguments. ex:#!/usr/bin/ksh echo $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 param "this" "is" "the" "worst" "script" "in" "the" "whole" "world" "for" "sure" output: this is the worst script in the whole world this0 its... (1 Reply)
Discussion started by: edog
1 Replies
Login or Register to Ask a Question