I have a shell script in which i have defined some variables like
Shell script.sh xyz /abc/def/cde
usecase=${1}
CONFIGDIR=${2}
And I have a config file in which i want to take these variables
config file
USECASE=${usecase}
CONFIG=${CONFIGDIR}
Can you help me how to take the variable from the shell script to config file. I am thinking to use "source" command. I am not sure if that help. Can anyone point me to the right direction?
You can do it with given commands in shell script
usecase=${1}
CONFIGDIR=${2}
key1="USECASE="
key2="CONFIG="
echo $key1$usecase >> /path/to/your/config/file
echo $key2$CONFIGDIR >> /path/to/your/config/file
Make sure to replace "/path/to/your/config/file" with path of your config file
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.