Resolving variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux