How to extract values from a java properties files in a bash/shell script and store in a variable and cd to that variable

后端 未结 2 1333
走了就别回头了
走了就别回头了 2021-01-14 18:37

I have a config.properties file which contains a path like ouputdir=/data1/testdata/output. I am able to extract these in shell and store this path in a variabl

2条回答
  •  误落风尘
    2021-01-14 18:46

    What you have should work. Check the obvious, that the directory is spelled right and does exist.

    For what it's worth, you could combine the grep and awk commands into one:

    my_value=$(awk -F= '$1=="outputdir" {print $2}')
    

提交回复
热议问题