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 1334
走了就别回头了
走了就别回头了 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:42

    Does your properties file have windows CRLF line endings? your script may think the directory is /data1/testdata/output^M with the trailing carriage return.

    sed -n '/^outputdir=/{s///; s/\r$//; p; q}' properties.file
    

提交回复
热议问题