Pass value from file to parameter


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Pass value from file to parameter
# 8  
Old 12-05-2011
Something weird is happening. It is getting assigned but when called for, i am not able to retrive the value. Check the logs below.

Code:
#!/usr/bin/ksh
tr '=' ' ' < Dallysales.prm | while read parm value
 do
 case $parm in
 'GP_BATCH_TRK_ID') Tracking_ID=${value} ;;
 'GP_IP_FILE1') File=${value} ;;
 'GP_SLS_DT_CURR_YR') Sales_date=${value} ;;
 'GP_COUNTRY') Country=${value} ;;
 'GP_BUSINSS_UNIT') BU=${value};;
 esac
 done
+ tr = ' '
+ read parm value
+ case $parm in
+ Tracking_ID=56
+ read parm value
+ case $parm in
+ File='/appl/data/Input/US/DAILYSLS_US_LOAD*.txt'
+ read parm value
+ case $parm in
+ Sales_date=20110524
+ read parm value
+ case $parm in
+ Country=US
+ read parm value
+ case $parm in
+ BU=GMUS
+ read parm value
echo $Tracking_ID;
+ echo
echo $File;
+ echo
echo $Sales_date;
+ echo
echo $Country;
+ echo
echo $BU;
+ echo

# 9  
Old 12-05-2011
Are you running it as an executable, or sourcing the file with '.'?

Executable will create a subshell, so the variables won't be set in the parent, whereas source should run in the current environment. Although, so should running the commands directly...
# 10  
Old 12-06-2011
I am running it dirrectly from the shell script. There is no subshell. There is only shell with these commands thats all.

I even gave export variablename=value. but still it is not working. Can you please let me know how to capture it in variables.

cheers!!!

---------- Post updated 12-06-11 at 11:27 AM ---------- Previous update was 12-05-11 at 07:34 PM ----------

Hi, Can somebody help me to understand why even after the assignment the values are not geting reflected on recall (echo)..

Cheers!!!!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How pass the input parameter to a file in the script ?

OS version: RHEL 6.7 myTextFile.txt file is referred within Script1.sh script, I only execute Script1.sh and I want the input variable to be passed inside myTextFile.txt . Any idea how I can do this ? $ cat script1.sh cat myTextFile.txt $ cat myTextFile.txt $1 Requirement1.... (4 Replies)
Discussion started by: kraljic
4 Replies

2. Shell Programming and Scripting

How to pass the parameter in xml file in UNIX shell script?

Hi, I have an XML file like the following... <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ONDEMAND_JOB VERSION="5.1" LOCALE="en_US"> <IMPORT_JOBSET TC_CONNECTION_NAME="default" ENVIRONMENT="PRD" USERNAME="Administrator" PASSWORD="AdminPassword" CALENDAR="Main Monthly Calendar"... (3 Replies)
Discussion started by: Debalina Roy
3 Replies

3. Shell Programming and Scripting

How to pass the parameter in xml file in UNIX shell script?

Hi, I have an XML file like the following... <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ONDEMAND_JOB VERSION="5.1" LOCALE="en_US"> <IMPORT_JOBSET TC_CONNECTION_NAME="default" ENVIRONMENT="PRD" USERNAME="Administrator" PASSWORD="AdminPassword" CALENDAR="Main Monthly Calendar"... (2 Replies)
Discussion started by: Debalina Roy
2 Replies

4. Programming

How to pass parameter from file to sqlplus in UNIX?

i have file in which i have employee id are there and every time number of employee id are different in file means number of count of employee id in file are every time different. 343535435 365765767 343534543 343543543 i want to pass this file to sqlplus and sql command is ... (7 Replies)
Discussion started by: pallvi_mahajan
7 Replies

5. Shell Programming and Scripting

Pass parameter

Hi, I have following for loop , please let me know how to get ${TXP_EXT_TABLE_${i}_SQL} parameter with 1DAY and 7DAY values. for i in 1DAY 7DAY do ${NZSQL_DIR}/nzsql -h ${HOST} -time -v ON_ERROR_STOP=1 -f ${SQL_DIR}/${TXP_EXT_TABLE_${i}_SQL} > ${TMP_LOG_FILE} 2>&1 done ... (4 Replies)
Discussion started by: sandy162
4 Replies

6. UNIX for Dummies Questions & Answers

How to pass the parameter value to a... ?

Hello I have a simple code like this one: #!/bin/ksh VER=$1 cat /usr/text | while read line do echo $line done Let's say $1=1.0.0 and the contents of text is: abcd.cfg asdf I would like the output to be like this abcd1.0.0.cfg asdf1.0.0 I am thinking of passing the... (5 Replies)
Discussion started by: khestoi
5 Replies

7. Shell Programming and Scripting

Pass input and output file as parameter to awk script

Hi, i am new to awk. I am using csv2pipe script(shown below) BEGIN { FS=SUBSEP; OFS="|" } { result = setcsv($0, ",") print } # setcsv(str, sep) - parse CSV (MS specification) input # str, the string to be parsed. (Most likely $0.) # sep, the separator between the values. # #... (6 Replies)
Discussion started by: bhaskarjha178
6 Replies

8. Shell Programming and Scripting

How to pass a parameter

Hi all, How to pass a parameter from a oracle pl/sql procedure parameter to shell environment and use it? (1 Reply)
Discussion started by: megh
1 Replies

9. Shell Programming and Scripting

Pass tablename as a parameter in the Control File -- sqlldr

Just wanted to know if there is a way to pass the table name as a parameter in the control file. I have two tables...Table A and Table B. LOAD DATA append INTO TABLE TABLE_B FIELDS TERMINATED BY X'09' OPTIONALLY ENCLOSED BY '"' AND '"' TRAILING NULLCOLS Rather than hard coding... (1 Reply)
Discussion started by: madhunk
1 Replies
Login or Register to Ask a Question