【发布时间】:2012-02-02 08:24:12
【问题描述】:
如何将以下 if 语句合并到一行中?
if [ $# -eq 4 ]
then
if [ "$4" = "PREV" ]
then
print "yes"
fi
fi
if [ $# -eq 3 ]
then
if [ "$3" = "PREV" ]
then
print "yes"
fi
fi
我正在使用 ksh。
为什么会报错?
if [ [ $# -eq 4 ] && [ "$4" = "PREV" ] ]
then
print "yes"
fi
错误:
0403-012 测试命令参数无效。
【问题讨论】: