The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
extracting parameter from file bp_vardhaman Shell Programming and Scripting 9 09-04-2008 11:24 PM
reading the parameter from another file dsravan Shell Programming and Scripting 15 12-20-2007 05:59 PM
how do I make dynamic parameter names? Or get the value of a parameter evaluated twi Awanka Shell Programming and Scripting 2 04-19-2007 10:37 PM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 05:25 AM
max file parameter ( urgent ) fmmq Filesystems, Disks and Memory 2 07-25-2002 06:00 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-21-2008
Raamc Raamc is offline
Registered User
  
 

Join Date: Sep 2007
Posts: 31
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 (permalink)  
Old 10-21-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,807

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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:00 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0