Shell基础--运行Bash脚本的方式

  1. 使用shell来执行

    $ sh hello.sh

  2. 使用bash来执行

    $ bash hello.sh

  3. 使用.来执行

    $ . ./hello.sh

  4. 使用source来执行

    $ source hello.sh

  5. 还可以赋予脚本所有者执行权限,允许该用户执行该脚本

    $ chmod u+rx hello.sh
    $ ./hello.sh

猜你喜欢

转载自blog.51cto.com/phpme/2329079
今日推荐