UNIX Script - setting dynamic variables (indirect variable reference)

后端 未结 2 720
别那么骄傲
别那么骄傲 2021-01-25 11:55

How to set shell variables from an input file ?

hello,

I need to set dynamic variable from an .ini file in a shell script.

Assume the input file is in

2条回答
  •  一个人的身影
    2021-01-25 12:26

    Solved

    using :

    file="install.ini"
    while IFS== read -r f v
    do
      eval "$f=$v"   
    done <"$file"
    

    did the trick.

提交回复
热议问题