ubuntu运行了shell脚本之后远程登陆会闪退?

我写了如下脚本:

#! /bin/bash
source service supervisor stop
source service supervisor start
source service nginx restart

chmod 755给了权限之后运行了一下。返回了:
stopping supervisor...
之后将脚本改为:

#! /bin/bash
source service supervisor stop &&
source service supervisor start &&
source service nginx restart 

再次运行,还是返回:

stopping supervisor...

等我再在终端中使用以下任意命令:

source service supervisor start
source service supervisor status

nginx的命令也是同样的情况。闪退之前会提示:

basename invalid option -- 'b'
Try 'basename --help' for more information.

对linux不太了解,看了两眼教程就写了脚本,这回知道错了。求各位给指点一二。

阅读 6.1k
1 个回答

把source去掉试试

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题