The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how do I pass or read values from file ? nix-kid Shell Programming and Scripting 1 05-20-2008 10:04 AM
read from a file and calculate values for a specified field lucho_1 Shell Programming and Scripting 3 03-11-2008 04:24 PM
Read the csv file and assign the values in to variable rajbal Shell Programming and Scripting 9 09-28-2006 04:49 PM
Korn Shell Script - Read File & Search On Values run_unx_novice Shell Programming and Scripting 2 06-15-2005 04:20 AM
Read data from a file into a variable yorkdg Shell Programming and Scripting 2 12-09-2004 02:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 03-13-2005
Registered User
 

Join Date: Feb 2005
Posts: 68
How can I read variable values from file?

Hi,
I want to pratmeterze my scripts like,
my confRsync file contains varibale values for 1. host 2. Destination and 3. source like this, I want to read this values from this and assing to my makeRsyn.sh file's varibales.
how to do this?
Reply With Quote
Forum Sponsor
  #2  
Old 03-14-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
If I understand correctly, you are looking towards sourcing a file of variable assignments into your script?

For example, let's say we have a file "confRsync" containing the following...
Code:
var_1="value 1"
var_2="value 2"
Then, within our script, we can source these assignments into the current environment...
Code:
#!/bin/sh

. /path/to/confRsync

echo "$var_1"
echo "$var_2"
The script will produce the output
Code:
$ ./makeRsyn.sh
value 1
value 2
Cheers
ZB
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0