0
我想从命令提示符调用一个函数,但我找不到调用它的正确方法。如何调用函数
这是我的脚本:
echo "Hello World!"
test {
echo "Sample message"
}
我尝试以下方法:
sh-4.2$ main.sh test
Hello World!
./main.sh: line 5: usuage: command not found
A helpful message!
./main.sh: line 8: syntax error near unexpected token `}'
./main.sh: line 8: `}'
sh-4.2$ . main.sh test()
sh: syntax error near unexpected token `('
你能帮我解决这个问题吗?
@Inian,刚刚添加。 – user3181365
使用我的答案在下面! – Inian