Reading a Parameter File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Reading a Parameter File
# 1  
Old 10-21-2008
Reading a Parameter File

Hi,

I need to read the parameters from a file and assign them to Global variables. I need to read a specific parameter value every time and pass it to the other script.

Suppose i have a parameter file like PARAM.txt
PAR1= VAL1
PAR2= VAL2
PAR3= VAL3

I want to read PAR2 file and in the next run i need to read PAR3.

can any one suggest me the how to read PAR2 value into global variable GLOB1?
# 2  
Old 10-21-2008
Code:
while read rec
do
     eval "$rec"
done < PARAM.txt
export GLOB1="$PAR1"
......... commands here
export GLBOB1="$PAR2"
........  more commands here

That sets all the PAR[n] variables inside the script. I'm am not clear on the rest of your requirement. In PARAMS.txt there cannot be any spaces around the = otherwise this will not work.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To call Oracle procedure by reading parameter file in UNIX

hi Guys, is there a way to pass parameter into oracle store procedure by reading date range in file and increment accordingly. Something like this file.txt 01-JAN-2015 03-JAN-2015 sqlplus -s user/pwd@DB execute TEST( to_date( '01-JAN-2015, 'dd.mm.yyyy' ), to_date( '03-JAN-2015', ... (1 Reply)
Discussion started by: rohit_shinez
1 Replies

2. Shell Programming and Scripting

How to get the parameter value from the parameter file in perl?

hi all, i have a parameter file of following format, i want a method which can get the value of specific parameter. parameter file format: <Parameter Name="FileLocationWindows"> <Description> The directory location of the logger file. ... (1 Reply)
Discussion started by: laxmikant.hcl
1 Replies

3. Shell Programming and Scripting

Passing parameter to script, and split the parameter

i am passing input parameter 'one_two' to the script , the script output should display the result as below one_1two one_2two one_3two if then echo " Usage : <$0> <DATABASE> " exit 0 else for DB in 1 2 3 do DBname=`$DATABASE | awk -F "_" '{print $1_${DB}_$2}` done fi (5 Replies)
Discussion started by: only4satish
5 Replies

4. Shell Programming and Scripting

Command that takes one parameter and then searches for the passed in parameter

Hi I am looking for a unix command or a small shell script which can takes one parameter and then searches for the passed in the parameter in any or all files under say /home/dev/ Can anyone please help me on this? (3 Replies)
Discussion started by: pankaj80
3 Replies

5. Shell Programming and Scripting

Help with reading parameter.

Hi,. I need a help with below strange behaviour. I use into script parameters as read A read B and my parameter B (password from Active directory) is changed by adding backslash to all characters (123456as; -> \1\2\3\4\5\6\a\s\;) and I use it as parameter into script. When I pass it to... (5 Replies)
Discussion started by: beckss
5 Replies

6. Shell Programming and Scripting

Reading a variable from parameter file

HI all, I have a parameter file with entries like $$Name =Abhinav $$CUTOFF_DATE = 11/11/2209 I am reading a variable from this file using a awk command like : var2=`awk -F"" "/CUTOFF_DATE/{f=$1;}{print f;}" InputFIleName` but facing an error like awk: cmd. line:1:... (3 Replies)
Discussion started by: abhinav192
3 Replies

7. UNIX for Dummies Questions & Answers

Reading from a file(passing the file as input parameter)

hi I have a shell script say primary.sh . There is a file called params my scenario is primary.sh should read all the values and echo it for example i should pass like $primary.sh params output would be Abc ... (2 Replies)
Discussion started by: ssuresh1999
2 Replies

8. Shell Programming and Scripting

Getting the value from a parameter file

Hi I am nebie to Unix I have a prameter file which has semicolon seperated values which has the field STATUS_CODE;9000;1;1200;2000 The values are dynamic ie. it can be 1,2,3...any number How do i get all the values of this parameter into a variable Please if anyone can help me out on... (2 Replies)
Discussion started by: theeights
2 Replies

9. Shell Programming and Scripting

reading the parameter from another file

I have a script where 3 parametrs are passed to it and it creates the file for each site form a template. If i want to get the 3rd parameter (which is the site) passed to the script to come from another file how I can change the script tp acheive it? Here is my script: what i have in the... (15 Replies)
Discussion started by: dsravan
15 Replies

10. Shell Programming and Scripting

how do I make dynamic parameter names? Or get the value of a parameter evaluated twi

Say I write something like the following: var1=1 var2=2 for int in 1 2 do echo "\$var$int" done I want the output to be: 1 2 Instead I get something like: $var1 $var2 (2 Replies)
Discussion started by: Awanka
2 Replies
Login or Register to Ask a Question