我正在尝试bash script在我的Ubuntu机器上运行,它给了我一个错误:
功能未找到
为了测试,我创建了以下脚本,它可以在我的笔记本电脑上正常工作但不能在我的桌面上工 任何想法为什么?如果相关,我的笔记本电脑是mac.
#!/bin/bash
function sayIt {
echo "hello world"
}
sayIt
Run Code Online (Sandbox Code Playgroud)
这会在我的笔记本电脑上返回"hello world",但在我的桌面上会返回:
run.sh:3:找不到函数hello world run.sh:5:语法错误:"}"意外