问答详情
源自:9-2 脚本执行方式

我写了脚本,使用bash hello.sh可以允许,chomd后直接运行就提示command not found

我写了脚本,使用bash hello.sh可以允许,chomd后直接运行就提示command not found

这是为啥呀?

提问者:慕婉清75226 2018-04-21 11:51

个回答

  • qq_这很秦公子_0
    2018-07-11 11:06:26

    chmod  哥们  你写错了

  • 莫克_moke
    2018-04-24 13:39:02

    举个例子:cat hello.sh == cat ./hello.sh,也就是可以推导出 hello.sh == ./hello.sh,即这两个是等价的

    那么问题来了:hello.sh本身就是sh目录下啊,为什么直接写“hello.sh”不可以?


  • 慕婉清75226
    2018-04-21 12:00:36

    知道了,./代表  从当前目录寻找  

  • 慕婉清75226
    2018-04-21 11:55:21

    知道了  我没有写  ./  ,而是直接写的hello.sh ,我想问,我当前就在sh目录下,hello.sh也在sh目录下,为什么直接写hell.sh不能运行,要用./  才可以?