Answer the question
In order to leave comments, you need to log in
How to set data from a certain config to a script?
In python, this is done something like this:
There is a config "settings"
in it there are entries like
[root_info]
root_login = root
root_pass = 12345
root_email = [email protected]
[urls_info]
global_url=192.168.0.1
settings = SafeConfigParser()
settings.read('./settings')
USER = settings.get('root_info', 'root_login')
PASS = settings.get('root_info', 'root_pass')
MYIP = settings.get('urls_info', 'global_url')
Answer the question
In order to leave comments, you need to log in
In config (script.cfg):
Param1=Value1
Param2=Value2
. script.cfg
#!/bin/bash
IFS="="
while read -r name value
do
echo "$name is $value"
done < "config.cfg"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question