The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > 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 07:36 AM
test command looks strange... jjinno Shell Programming and Scripting 2 11-02-2007 07:31 PM
the TEST command marwan UNIX for Dummies Questions & Answers 2 04-23-2007 06:51 PM
test command is not working zam Shell Programming and Scripting 2 07-04-2006 09:42 PM
Linux test command pvar Linux 4 07-15-2004 06:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-03-2007
JWilliams JWilliams is offline
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...
  #2 (permalink)  
Old 12-03-2007
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
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
  #3 (permalink)  
Old 12-04-2007
gus2000 gus2000 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 157
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:43 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0