我想我的Ubuntu机器上运行一个bash script
和它给我一个错误:Bash脚本错误:“function:not found”。为什么会出现?
function not found
为了测试,我创建了下面的脚本,它工作在我的笔记本电脑却没有关于我的桌面罚款。任何想法为什么?我的笔记本电脑是一个mac,如果这是相关的。
#!/bin/bash
function sayIt {
echo "hello world"
}
sayIt
这将返回的 “hello world” 我的笔记本电脑,但在我的桌面,它返回:
run.sh: 3: function not found hello world run.sh: 5: Syntax error: "}" unexpected
任何帮助将非常感激。
给了我一个:语法错误“(”意外 –
可悲的是,我真的不知道为什么我对这个问题的答案downvoted:/ –
您应该包括''在()函数的定义,但不当你调用函数 – Jacob