zsh-workers
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi  <hzoli@cs.elte.hu>
To: glenn@mathcs.emory.edu
Cc: zsh-workers@math.gatech.edu (zsh-workers)
Subject: Re: [[ str == pat ]] ?
Date: Thu, 12 Oct 1995 13:07:41 +0100 (MET)	[thread overview]
Message-ID: <199510121207.NAA13791@bolyai.cs.elte.hu> (raw)
In-Reply-To: <199510120542.BAA08305@drella.mathcs.emory.edu> from "Glenn Barry" at Oct 12, 95 01:42:33 am

Glenn Barry wrote:
> most excellant zsh workers,
> 
> According to the "Korn Shell Ref" card (updated for ksh93) from SSC
> 
> 	[[ str == pat ]]
> 
> is preferred  and 
> 
> 	[[ str = pat ]] 
> 
> is "obsolete" (but still works of course).
> 
> Can the == for [[ be added to zsh?  We've got some code that
> needs to work on both ksh and zsh so it would be nice...

My ksh manual from Solaris 5.4 (Last change: 3 Aug 1993) does not mention
this, but I tried the ksh here, and it accepted the == syntax.  Here is a
patch to zsh to do that.  This makes [[ ... = ... ]] and [[ ... == ... ]]
equivalent.

Could you post your ksh documentation?

Cheers,
  Zoltan

*** 1.4	1995/10/10 18:24:53
--- Src/parse.c	1995/10/12 11:30:30
***************
*** 1320,1326 ****
      Cond n = (Cond) make_cond();
      int t0;
  
!     if ((b[0] == Equals || b[0] == '=') && !b[1])
  	n->type = COND_STREQ;
      else if (b[0] == '!' && (b[1] == Equals || b[1] == '=') && !b[2])
  	n->type = COND_STRNEQ;
--- 1320,1327 ----
      Cond n = (Cond) make_cond();
      int t0;
  
!     if ((b[0] == Equals || b[0] == '=') &&
! 	(!b[1] || ((b[1] == Equals || b[1] == '=') && !b[2])))
  	n->type = COND_STREQ;
      else if (b[0] == '!' && (b[1] == Equals || b[1] == '=') && !b[2])
  	n->type = COND_STRNEQ;
*** 1.4	1995/10/10 20:13:12
--- Doc/zshmisc.1	1995/10/12 12:05:23
***************
*** 997,1003 ****
--- 997,1007 ----
  .I file2
  exist and refer to the same file.
  .TP
+ .PD 0
+ \fIstring\fP \fB==\fP \fIpattern\fP
+ .TP
  \fIstring\fP \fB=\fP \fIpattern\fP
+ .PD
  true if
  .I string
  matches


  reply	other threads:[~1995-10-12 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-10-12  5:42 Glenn Barry
1995-10-12 12:07 ` Zoltan Hidvegi [this message]
1995-10-12 18:19   ` ksh compatibility Richard Coleman
1995-10-12 20:36   ` [[ str == pat ]] ? Glenn Barry
1995-10-13  4:32     ` Arnold D. Robbins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199510121207.NAA13791@bolyai.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=glenn@mathcs.emory.edu \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).