How to expand shell variables in a text file?

前端 未结 10 1449
夕颜
夕颜 2021-02-04 02:05

Consider a ASCII text file (lets say it contains code of a non-shell scripting language):

Text_File.msh:

spool on to \'$LOG_FILE_PATH/lo         


        
10条回答
  •  [愿得一人]
    2021-02-04 02:47

    If the variables you want to translate are known and limited in number, you can always do the translation yourself:

    sed "s/\$LOG_FILE_PATH/$LOG_FILE_PATH/g" input > output
    

    And also assuming the variable itself is already known

提交回复
热议问题