substituting shell variables


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting substituting shell variables
# 1  
Old 10-16-2002
substituting shell variables

I have a script run_batch.sh as below :-

PAR_VALIDATION=val_siconf
PAR_RUN_LEVEL=1
PAR_EXCLUSIVE_RUN_YN=Y
DATABASE_USER="/@"$TWO_TASK
sqlplus -s $DATABASE_USER |&
print -p -- 'set feed off pause off pages 0 head off veri off line 500'
print -p -- 'set term off time off serveroutput on'
print -p -- "set sqlprompt ''"
print -p -- "SELECT run_command from tmp_run_batch;"
read -p run_command
echo $run_command
print -p -- "execute dbms_output.put_line($run_command);"


The sql statement "SELECT run_command from tmp_run_batch;" gives the output :-
pack_claims_clload_mesg.func_main($PAR_VALIDATION,$PAR_RUN_LEVEL,$PAR_EXCLUSIVE
_RUN_YN)


Now if I run the shell using the command :-
ksh run_batch.sh

It echoes :-
pack_claims_clload_mesg.func_main($PAR_VALIDATION,$PAR_RUN_LEVEL,$PAR_EXCLUSIVE
_RUN_YN)
without substituting the shell variables with their values and the next statement of executing the database package also fails.


Can you suggest any method to substitute the shell variables with their values ?



Cheers
Suds
# 2  
Old 10-16-2002
Try this as your last statement:
eval print -p -- \""execute dbms_output.put_line($run_command);"\"
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Nawk sub not substituting

I am trying to use nawk sub to substitute a string in a file. Both the pattern and the replacement I set as variables using bash. here is the code: #!/bin/bash -x ydate=`/usr/local/bin/date +%Y%m%d` echo $ydate test_ca=/home/mdadmin/test_ca for i in `cat ${test_ca}` do if ]; then... (9 Replies)
Discussion started by: smenago
9 Replies

2. Shell Programming and Scripting

Substituting a shell variable in sed

Hi guys, I'm trying to figure out how to use a shell variable inside my sed command. I just want to remove a certain part of a path. I've tried three different combinations and none of them work. Here are the three combinations: echo $file | sed 's/'$test'//' echo $file | sed "s/$test//"... (7 Replies)
Discussion started by: chu816
7 Replies

3. UNIX for Dummies Questions & Answers

Variable is not substituting values

Hi All, OS HPUX 11.11 I am using following script to take controlfile backup. I have used SID variable to hold "ffin1" value, which I again subsitute in "'/db/ffin1/home/oraffin1/$SID_$wdate.ctl'" command. Well, after running this, SID variable does not subsittue it's value, while wdate... (6 Replies)
Discussion started by: alok.behria
6 Replies

4. UNIX for Dummies Questions & Answers

substituting variable value in AWK

Hi All, my requirement is as below. I need to replace a value in a particular column with a substitution variable(date value) and modified value of the current column value in the same position. for ex. i have a record like 02;aaaa;bbbbb;cccccc;dddddd;123456789;hhhhh;12hs;asdf ;... (3 Replies)
Discussion started by: ganesh_248
3 Replies

5. Shell Programming and Scripting

issue with substituting using sed

have a fileA containing about 260 lines wherein i have to match 2 lines fileA blah blah OF 90 DAYS DOCS PERIOD 12/06/0" Pairs_Id 52006 Amount1 -300000.0 Amount2 15091500.10 Codifiers_Id 0 OriginalId 0 EOT --blah blah blah TBL Tradt_IN CardRate 0.0 hashAmount -15091500.0... (2 Replies)
Discussion started by: sunnyboy
2 Replies

6. Shell Programming and Scripting

Substituting the values

Hi Gurus this is working finee with tested values #!/bin/ksh V_DATE="2007-11-30" V_ID=789 V_NAME="john_${V_ID}_has_${V_DATE}_s" FILE_NAME=`echo ${V_NAME}` echo ${FILE_NAME} Buttt the problem is the first two values will come dynamically and the file will looks like... (2 Replies)
Discussion started by: SeenuGuddu
2 Replies

7. Shell Programming and Scripting

Substituting Characters using SED

Can SED be used to substitute a character (y) with a character (Y) in a specified field? File has 12000 : delimeted rows as; HHC 1 BDE:Lastname, Firstname MI:firstname.mi.lastname@mil:SGT HHC 2 BDE:Lastname, Firstname MI:Firstname.MI.Lastname@mil:SGT I wish to replace the capital letters... (6 Replies)
Discussion started by: altamaha
6 Replies

8. Programming

substituting one string for another

I have a Linux C program I'm writing that has one section where, within a large string, I need to substitute a smaller string for another, and those probably won't be the same size. For instance, if I have a string: "Nowisthetimeforallgoodmen" and I want to substitute 'most' for 'all' the... (2 Replies)
Discussion started by: cleopard
2 Replies

9. Shell Programming and Scripting

Substituting variables from external files

Hi All, I have the following problem: 1. I have a file containing a line: a,b,d,${d},e,f 2. From within a script I grep the file for '^a,' to get the line 3. I obtain the fourth field as follows: Field4="$( print -r $fileEntry | cut -d, -f4 )" 4. The script exports variables at the... (1 Reply)
Discussion started by: oneillc9
1 Replies

10. Shell Programming and Scripting

substituting

Hello please how can i change this infrormation within a file dynamically without using vi " || $6 ~ /^229*/ " the * means any number within the file has this content : cat lec|awk -F '|' 'length($6) >= 12 || length($6) <= 10' |awk -F '|' '$6 ~ /^24/ || $6 ~ /^22924/ &&$7 ~... (1 Reply)
Discussion started by: neyo
1 Replies
Login or Register to Ask a Question