3 simple steps to make booting/shutdown faster...
adam at spicenitz.org
Sun Feb 17 16:27:14 UTC 2008
Arjan van de Ven wrote:
> Behdad Esfahbod <behdad at behdad.org> wrote:
>> On Sat, 2008-02-16 at 18:40 -0800, Arjan van de Ven wrote:
>>> * if you do if [ -f FOO -o -f BAR ] in bash, bash will look to see
>>> if BOTH files exist, and then decides that since FOO exits,
>>> everything is fine and executes the if body. Looking for
>>> non-existing files (first time) is expensive.. so splitting this
>>> kind of "if" in two reduces disk seeks and IO. [this kind of split
>>> I had to do in a few places]
>> This should really be fixed in bash to short-circuit.
> well......... not sure it can be done in the bash language.
> (it may well guarantee that both get executed)
From bash info page:
`EXPRESSION1 || EXPRESSION2'
True if either EXPRESSION1 or EXPRESSION2 is true.
The `&&' and `||' operators do not evaluate EXPRESSION2 if the
value of EXPRESSION1 is sufficient to determine the return value
of the entire conditional expression.
So, replace "-o" with "||" ? (And "[" with "[[" and "]" with "]]" ?)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 259 bytes
Desc: OpenPGP digital signature
More information about the fedora-devel-list