-   Linux - Newbie (
-   -   Setting variables from a template (

Feynman 08-23-2010 12:38 PM

Setting variables from a template
Is there a way I can write a file that contains the text which assigns variables, e.g.
string="hello world"
in a file say, variables.txt and have a shell script assign those variables locally e.g.

command_that_saves_variables_locally variables.txt
echo $string

and when I run the script I would get an output of
"hello world"

tuxtutorials 08-23-2010 12:53 PM

Have you tried:


. variables.txt
This should work too:


source variables.txt

Feynman 08-23-2010 01:08 PM

That worked great! Wow--that sure is simple in bash!

All times are GMT -5. The time now is 02:51 AM.