Here is my statements:
print "Ss $# $2" >&3
if [ $# -eq 4 || $# -eq 3 ] && [ $2 != "d" ]
then
print "sss"
else
print "lol"
fi
The output is:
Ss 4 s
lol
Why is "sss" not being displayed?
Your if-condition isn't syntactically correct. You can't have || inside the brackets. Change it to use -o instead:
if [ $# -eq 4 -o $# -eq 3 ] && [ $2 != "d" ]
then
print "sss"
else
print "lol"
fi
Or, even better, use [[ (if your shell supports it) which is safer and has more features. It supports ||:
if [[ ( $# -eq 4 || $# -eq 3 ) && $2 != "d" ]]
then
print "sss"
else
print "lol"
fi