更新时间:2023-01-22 22:30:39
这应该有效:
#!/bin/bash
if [ "$#" -eq 0 ] || [ "$#" -gt 1 ] ; then
echo "hello"
fi
我不确定在其他shell中这是否不同,但是如果您想使用< ;,>,则需要将它们放在双括号内,如下所示:
I'm not sure if this is different in other shells but if you wish to use <, >, you need to put them inside double parenthesis like so:
if (("$#" > 1))
...