0

I am trying create a generic shell script for deployment which will read from a common properties file for all env. Based on the environment tag it will fetch the values and use them to deploy using bash scripts.

Properties file looks like:

dev.servername=devnode1,devnode2
dev.rootdir=/server/someapps

test.servername=testnode1,testnode2
test.rootdir=/server/someapps

The idea is to fetch values for dev only if the argument for environment is dev and so on. Also to store the server names in an array to run commands in loop for all the servers.

Appreciate any input.

  • You're telling us what you want to do -- how about telling us what part of it you're having trouble with? If you just want to know how to read a file line-by-line, see [BashFAQ #1](http://mywiki.wooledge.org/BashFAQ/001). If you want to know how to store key/value pairs in memory, see [BashFAQ #6](http://mywiki.wooledge.org/BashFAQ/006) on associative arrays. – Charles Duffy Oct 21 '17 at 23:12
  • If you want to know how to test whether a line starts with a prefix (thus, to filter only for the environment you care about), see [In bash, how can I check if a string begins with some value?](https://stackoverflow.com/questions/2172352/in-bash-how-can-i-check-if-a-string-begins-with-some-value). – Charles Duffy Oct 21 '17 at 23:15
  • ...but please, when asking a question, make it clear that you *did* already make a good-faith effort to search for duplicates, and exactly why/how possible duplicates didn't help you -- that way it's clear how your question is different, and thus where answers to it need to focus. – Charles Duffy Oct 21 '17 at 23:16

0 Answers0