How to substitute a varible in script having value including quotes?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to substitute a varible in script having value including quotes?
# 1  
Old 02-12-2011
How to substitute a varible in script having value including quotes?

Hi All,
We need to run a Connect direct script on Unix server to send a file to Mainframe server and at mainframe end there need to run another job through Runtask with some parameters need to be passed from CSmilie (unix) to mainframe.
My question is I have to pass parameters like DSN and FNAME as included in SYSOPTS to mainframe, but the FNAME should get value from variable FNM defined above including quotes.
FNM='Myfile.txt'
SYSOPTS="'DSN=TCT.IBN.SHR','FNAME=&FNM'&q uot;

i.e. I want like this
SYSOPTS="'DSN=TCT.IBN.SHR','FNAME='Myfile.txt ''"

But my problem is, this script is giving error i.e. it is not substituting value of FNM with quotes.

Please help to resolve my query.

Thanks in advance.
Vijay
# 2  
Old 02-12-2011
Hi
In place of &, put $.

Code:
SYSOPTS="'DSN=TCT.IBN.SHR','FNAME=$FNM'

Guru
# 3  
Old 02-12-2011
Code:
FNM=Myfile.txt
SYSOPTS="'DSN=TCT.IBN.SHR','FNAME=$FNM'"


Last edited by cfajohnson; 02-12-2011 at 07:31 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Getting error while including values in xml tags using shell script

Hi All, Please find the code below where I want to add the variable value in between the XML tags. I am taking one string and my goal is to put them between the xml tags. Ex : in between <name> , <lname> Kindly suggest a correction because while executing this script I am getting and... (8 Replies)
Discussion started by: rajneesh4U
8 Replies

2. Shell Programming and Scripting

Issue with Single Quotes and Double Quotes for prompt PS1

Hi, Trying to change the prompt. I have the following code. export PS1=' <${USER}@`hostname -s`>$ ' The hostname is not displayed <abc@`hostname -s`>$ uname -a AIX xyz 1 6 00F736154C00 <adcwl4h@`hostname -s`>$ If I use double quotes, then the hostname is printed properly but... (3 Replies)
Discussion started by: bobbygsk
3 Replies

3. Shell Programming and Scripting

Substitute Perl Script

I am having trouble with a part of my substitute script I am using. I have it look through a file and find an exact match and then if it finds that match in the 1 file it should run the following 1 liner on 3 different files. perl -pi -e 's/$CurrentName\s/$NewName/g' foo.cfg; The issue that is... (8 Replies)
Discussion started by: Takau
8 Replies

4. Shell Programming and Scripting

How to substitute the value with in double quotes in perl?

Hi, I have string like this: $str=' DNA OR ("rna AND binding AND protein")'; I just wanted to substitute AND with a blank. How can i do that? I want the output like this: $string= DNA OR ("rna binding protein") (3 Replies)
Discussion started by: vanitham
3 Replies

5. Shell Programming and Scripting

run a script to set a globle varible?

Hi, My original shell is csh, I don't likw it, so I have to run bash every time after I login, the problem is I have a script like export PLOG=$1, every time I run the script under bash, the PLOG won't be set, I know I can use source to set the PLOG, is there any other way to do it? ... (3 Replies)
Discussion started by: laopi
3 Replies

6. UNIX for Dummies Questions & Answers

Using sed to substitute between quotes.

I'm using sed to perform a simply search and replace. The typical data is: <fig><image href="Graphics/BAV.gif" align="left" placement="break" I need to replace the value in the first set of quotes, keeping the remainder of the line the same. Thus: <fig><image href="NEW_VALUE" align="left"... (3 Replies)
Discussion started by: Steve_altius
3 Replies

7. Web Development

PHP echo everything including brackets and quotes

How can I print exactly what I want in between my quotes? I have xml that I want to echo exactly and it is not printing out the brackets and gets hung up at the "<?" and all that. Is there a way I can just say echo exactly between these quotes? (2 Replies)
Discussion started by: mainegate
2 Replies

8. Shell Programming and Scripting

querry ..including external shell script

is there any way to include one shell script into other like include in c apart from putting it in a function (3 Replies)
Discussion started by: mobydick
3 Replies

9. Shell Programming and Scripting

chaging a environment varible using sheel script

hi How can one change an environment varaible inside a shell script say my bash shell has a env variable export FOO="Day" no i want to write a script inside which the FOO variable is modified to say export FOO=NIGHT after this script finishes te bash shell should show me NIGHT when i... (1 Reply)
Discussion started by: wojtyla
1 Replies

10. Shell Programming and Scripting

Using varible/varible substitution in Perl/sed Search & Replace

Hi, I have a program that searches for a particular string patten. I am however having difficulty passing the varible $i (in a loop) as the string pattern to replace. Using either perl or sed search and replace statements, I get the same kinda result. For example, using the perl: for i in... (3 Replies)
Discussion started by: Breen
3 Replies
Login or Register to Ask a Question