本文转载自:百度经验:Linux下如何运行.sh文件









      其中,以绝对路径运行方法:

      (1)./home/test/shell/hello.sh,可以这样运行是因为当前登录用户是root,当前路径是在/下,. 代表当前路径。

      (2)/home/test/shell/hello.sh,此路径为真实绝对路径,但此方式运行的条件是该用户对hello.sh拥有执行权限,即已执行chmod u+x hello.sh。

      (3)sh /home/test/shell/hello.sh,用sh命令执行shell脚本不需要该用户拥有hello.sh的执行权限即可执行。

相关文章:

  • 2022-12-23
  • 2022-02-26
  • 2021-06-01
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-29
  • 2021-12-06
  • 2021-12-16
  • 2020-10-28
  • 2022-12-23
  • 2021-12-16
  • 2021-06-22
相关资源
相似解决方案