Permission denied on cat via shell script
This question already has an answer here:
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.
上一篇: Bash使用JPS杀死Java进程
下一篇: 猫通过shell脚本拒绝了权限
