Permission denied on cat via shell script

This question already has an answer here:

  • How to set a variable to the output of a command in Bash? 13 answers

  • To assign the output of a command to a variable, wrap the command in backticks or $() .

    RESULT=$(cat $LOGFILE | tail -1)
    

    Your command performed the environment variable assignment RESULT=cat , and then executed the command $LOGFILE | tail -1 $LOGFILE | tail -1 in that environment. Since $LOGFILE is not an executable file, you got an error.

    链接地址: http://www.djcxy.com/p/57210.html

    上一篇: Bash使用JPS杀死Java进程

    下一篇: 猫通过shell脚本拒绝了权限