How to expand shell variables in a text file?

前端 未结 10 1447
夕颜
夕颜 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:46

    Yes eval should be used carefully, but it provided me this simple oneliner for my problem. Below is an example using your filename:

    eval "echo \"$(

    I use printf instead of echo for my own purposes, but that should do the trick. Thank you abyss.7 providing the link that solve my problem. Hope it helps.

提交回复
热议问题