The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > AIX
Google UNIX.COM


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
TEST command amatuer_lee_3 Shell Programming and Scripting 4 05-09-2008 04:36 AM
test command looks strange... jjinno Shell Programming and Scripting 2 11-02-2007 03:31 PM
the TEST command marwan UNIX for Dummies Questions & Answers 2 04-23-2007 03:51 PM
test command is not working zam Shell Programming and Scripting 2 07-04-2006 06:42 PM
Linux test command pvar Linux 4 07-15-2004 03:23 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-03-2007
Registered User
 

Join Date: Apr 2007
Posts: 9
Test command

Hello,

I am trying to add some tests to existing code. The code already contains some test commands. An example is as follows...

[[ ${retCode} == 2 ]] then

Does anyone know the purpose of the double equals? I would have used a single equals sign...
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-03-2007
Bughunter Extraordinaire
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,032
Barry Rosenberg ("Hands-On KornShell93 Programming", Addison-Wesley, 1998) says (p76, Table 6-2):

Quote:
[[ string = pattern ]] or
[[ string == pattern ]]

string equals pattern [...] The single equal sign operator is old-fashioned, but still supported.
I hope this clears things up.

Interestingly the man page for test in AIX 5.3 doesn't refer to any of the string operators.

bakunin
Reply With Quote
  #3 (permalink)  
Old 12-03-2007
Registered User
 

Join Date: Oct 2007
Posts: 153
The double-equal is the correct syntax for ksh93, although it will tolerate the single-equal to be backward-compatable with ksh88. In ksh88 (the default AIX shell) the single-equal is correct, but the double-equal is sometimes tolerated. By "sometimes" I mean the currently supported AIX versions. I don't believe it will work with ksh under AIX43 (or even AIX51) but these have both been out of support for some time.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:41 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0