How do I get value of variable from file using shell script?

前端 未结 4 1079
隐瞒了意图╮
隐瞒了意图╮ 2021-01-15 05:41

There is a file post_check.ini I need the value set for:

Max_value=2

How would I get the value 2 from Max_v

4条回答
  •  深忆病人
    2021-01-15 06:16

    I recommend using crudini which is a dedicated tool to manipulate ini files from shell

    value=$(crudini --get /usr/post_check.ini section Max_value)
    

    Details on usage and download at: http://www.pixelbeat.org/programs/crudini/

提交回复
热议问题