bash script: command not found

This question already has an answer here:

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

  • As the others said you need to capture the output from the commands.

    z=echo foo -bash: foo: command not found

    is not the same as

    z=$(echo foo)

    In the first one it's equivalent to

    z=echo foo

    which is not valid as it thinks foo is a command.

    z=$(echo foo) however means to execute echo foo and capture the output into z .

    All of your commands fail to do this.

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

    上一篇: 在Bash中的while循环中设置一个变量

    下一篇: bash脚本:找不到命令