sudo:./ untitled.sh:找不到命令

时间:2018-01-09 08:44:48

标签: bash shell

我在Mac上学习bash:

我的Mac中有一个最简单的bash脚本,名为untitled.sh

#!/bin/bash

echo "hello"

但在我的终端我想要运行它,我失败了:

$ sudo ./untitled.sh
Password:
sudo: ./untitled.sh: command not found

我不知道为什么会有错误,一切都好。

1 个答案:

答案 0 :(得分:4)

为您的脚本添加execute权限:

chmod +x untitled.sh

您可以使用

ll untitled.sh # Linux
ls -l  untitled.sh  # Mac

检查权限。