Resolving variables
james.wartnick at bestbuy.com
james.wartnick at bestbuy.com
Tue Oct 12 08:52:50 UTC 2004
Hopefully this isn't a repost. The first send of the e-mail gave me an error.
Anyway...
I'm hoping someone can help me with what would seem to be a simple problem.
I have a file that has many lines that look like the following.
$SOME_ENV_VAR/blah/blah/$SOME_OTHER_ENV_VAR
I want to read/cat the file and resolve the environment variables (not print out $SOME_ENV_VAR).
The only way I have been able to do this so far is by looping through the file,
line by line, and using the "eval echo $line" command
(e.g. cat file | while read line; do eval echo $line; done).
There's got to be a more efficient way (If there's thousands of lines, this takes a while).
Any help appreciated.
Thanks.
-Jim
More information about the redhat-list
mailing list