KSH if-then v. [[ ]] && || notation and relative speed of equivalent command constructs

J.B. Nicholson jbn35564 at uxa.cso.uiuc.edu
Tue Apr 16 02:59:25 AEST 1991


In KSH, which is faster:

if [[ ${a} = 5 ]] then print 'a is set to 5'
else print 'a is not set to 5'

...or...

[[ ${a} = 5 ]] && print 'a is set to 5' || print 'a is not set to 5'

I'm leaning toward the latter only because it looks like KSH wouldn't have
to bother with the IF command (or the THEN command either).

And on the same note, does anyone have a list or some sort of a reference
to which commands are faster than their equivalent options (such as the
above comparison)?  If so, could you post it (if there's enough interest)
or mail it to me (if nobody else cares)?

Thanks.

Jeff
--
+----------------------------------------------------------------------------+
| "If you hear an onion ring - answer it."                    J.B. Nicholson |
+----------------------------------------------------------------------------+
| jeffo at uiuc.edu (Internet)              These opinions are mine, that's all.|
+----------------------------------------------------------------------------+



More information about the Comp.unix.shell mailing list