The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Read the csv file and assign the values in to variable rajbal Shell Programming and Scripting 11 06-27-2009 01:17 PM
how do I pass or read values from file ? nix-kid Shell Programming and Scripting 1 05-20-2008 01:04 PM
read from a file and calculate values for a specified field lucho_1 Shell Programming and Scripting 3 03-11-2008 07:24 PM
Korn Shell Script - Read File & Search On Values run_unx_novice Shell Programming and Scripting 2 06-15-2005 07:20 AM
Read data from a file into a variable yorkdg Shell Programming and Scripting 2 12-09-2004 05:29 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 03-14-2005
redlotus72 redlotus72 is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 69
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?
  #2 (permalink)  
Old 03-14-2005
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
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
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 03:04 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