Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Sameer Sood
SCJP 1.5 (93%), SCWCD 1.5 (95%)
Sameer Sood
SCJP 1.5 (93%), SCWCD 1.5 (95%)
Tim Holloway wrote:The easy way to do it is to note that a Java properties file has the same format as a basic shell script.
However, there's a trick to it. If you just run the properties file like so:
sh appl.properties
The assignments will be made at the sub-level, then discarded when the properties file (script) ends execution.
So to get the properties in a calling script, you need to use the "source" command:
. appl.properties
Note that the space after the initial dot is very important!
To reference shell variable assignments, you use the "$" to indicate variable substitution.
So, to put it all together:
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Tim Holloway wrote:The easy way to do it is to note that a Java properties file has the same format as a basic shell script.
However, there's a trick to it. If you just run the properties file like so:
sh appl.properties
The assignments will be made at the sub-level, then discarded when the properties file (script) ends execution.
So to get the properties in a calling script, you need to use the "source" command:
. appl.properties
Note that the space after the initial dot is very important!
To reference shell variable assignments, you use the "$" to indicate variable substitution.
So, to put it all together:
Jay Dilla wrote:
[/code]
Here are a few solutions that are a little more robust: http://shrubbery.mynetgear.net/c/display/W/Reading+Java-style+Properties+Files+with+Shell
sameer sood wrote:This will require making properties file executable
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|