Answer the question
In order to leave comments, you need to log in
How to take parameter values from the config file into variables in linux using a bash script?
How to take parameter values from the config file into variables in linux using a bash script?
In general, there is a config, the structure is as follows:
KVM_VM_DISK_2="/var/lib/kvm/storage1/insta1"
KVM_VM_DISK_SIZE_2="2000"
Answer the question
In order to leave comments, you need to log in
You just need to write a function that takes the number of the entry in the input stream from which to take the value.
Then you just do
text=`cat file.conf`
val1=`echo "$text" | select_value 1`
val2=`echo "$text" | select_value 2`
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question