【发布时间】:2016-07-27 11:57:50
【问题描述】:
我用 bash 编写了一个简单的脚本。但是当我运行它时,它会在标题中给出错误。
#!/bin/bash
unix_OS=`uname`
function_aix()
{
echo "This is AIX os"
}
function_other()
{
echo " This could either be Linux/Solaris/Hp-UX"
}
if [ $unix_OS == AIX ]
then
echo "executing aix function"
function_aix()
else
echo "other function"
function_other()
fi
任何建议都会有所帮助!
【问题讨论】:
-
使用函数时,不能/不能使用
()s。只需传递所需的任何参数,即myFn arg1 "arg 2" arg3。祝你好运。 -
删除括号后,它工作正常。非常感谢:)
标签: shell