Skip to main content
deleted 10 characters in body
Source Link
Rui F Ribeiro
  • 58k
  • 28
  • 156
  • 239

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file in a Bash script and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, then check whether a certain variable fulfills a condition, such as (pseudocode):

if "variable1 = 25", then echo "confirm"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file in a Bash script and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, then check whether a certain variable fulfills a condition, such as (pseudocode):

if "variable1 = 25", then echo "confirm"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file in a Bash script and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, then check whether a certain variable fulfills a condition, such as (pseudocode):

if "variable1 = 25", then echo "confirm"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename
added 67 characters in body; edited title
Source Link
user317784
user317784

Parse config file and setpass parameters to another script

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file in a Bash script and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, then check whether a certain variable fulfills a condition, such as (I will be passing the variables/values to another scriptpseudocode).:

if "variable1 = 25", then echo "confirm"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

Parse config file and set parameters

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script (I will be passing the variables/values to another script).

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

Parse config file and pass parameters to another script

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file in a Bash script and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, then check whether a certain variable fulfills a condition, such as (pseudocode):

if "variable1 = 25", then echo "confirm"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename
added 24 characters in body
Source Link
user317784
user317784

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, so some pseudocode for example that illustrates what I would like (I will be passing the variables/values to do:

if variable1 = 25, then echo "confirmed"

if variable1 = 36, then echo "yes"another script).

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script, so some pseudocode for example that illustrates what I would like to do:

if variable1 = 25, then echo "confirmed"

if variable1 = 36, then echo "yes"

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename

Let's say I have a config file containing the following:

variable1 = 25
variable2 = 36

I want to parse this file and set each respective variable to its proper value within my script. How do I do this? I have the code at the bottom, but all this does is display the content. I want to actually set the variables and their values in my script (I will be passing the variables/values to another script).

IFS="="
while read -r name value
do
echo "Content of $name is ${value//\"/}"
done < filename
Source Link
user317784
user317784
Loading