In the shell script, I want to grep a value from the log file and set as the value of one environment. In the log file, there is one line like this:
SOME_PATH=/some/specific/path
In my shell script, I grep the SOME_PATH
keyword, and I got the above line and split it with =
, but I'm now able to set the environment variable:
line=`grep "SOME_PATH" /path/to/the/log.log`
path=${line##*=}
export SOME_PATH="$path" #I cannot change the environment variable with this line.
And if I just have the script like below in my bash file, the environment variable changes if I source the bash file.
export SOME_PATH=/some/specific/path