Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!wuarchive!zaphod.mps.ohio-state.edu!caen!news.cs.indiana.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!jbn35564 From: jbn35564@uxa.cso.uiuc.edu (J.B. Nicholson) Newsgroups: comp.unix.shell Subject: KSH if-then v. [[ ]] && || notation and relative speed of equivalent command constructs Summary: Which is faster in KSH: if-then or [[..]] constructs? What's faster than what (in general)? Keywords: KSH [[..]] && || if-then notation faster Message-ID: <1991Apr15.165925.26321@ux1.cso.uiuc.edu> Date: 15 Apr 91 16:59:25 GMT Sender: usenet@ux1.cso.uiuc.edu (News) Reply-To: jeffo@uiuc.edu Organization: University of Illinois at Urbana Lines: 26 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@uiuc.edu (Internet) These opinions are mine, that's all.| +----------------------------------------------------------------------------+