How to expand shell variables in a text file?

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

    #logfiles.list:

    $EAMSROOT/var/log/LinuxOSAgent.log
    $EAMSROOT/var/log/PanacesServer.log
    $EAMSROOT/var/log/PanacesStrutsGUI.log
    

    #My Program:

    cat logfiles.list | while read line
        do
            eval Eline=$line
            echo $Eline
        done
    

提交回复
热议问题