[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-bash] bash lazy evaluation with -a
From: |
Ken Goldman |
Subject: |
[Help-bash] bash lazy evaluation with -a |
Date: |
Tue, 24 Jun 2014 12:45:18 -0400 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 |
(checking before I report a bug)
I inherited some code that looks like this:
if [ $# -gt 3 -a $3 = "-ks" ];then
EC_SIGNING_KEY_SIZE=$4
fi
When I run with 2 arguments, I get:
rpm.sh: line 514: [: too many arguments
I think the coder expected the left side of the -a to be false, and thus
the right side would not be evaluated. Certainly C code does that. I
suspect that my invocation with $3 empty causes the error.
Is this implementation dependent and thus a bug, or is my analysis wrong?
- [Help-bash] bash lazy evaluation with -a,
Ken Goldman <=