Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: FPATH/autoload still strange in -dev-21



Bart Schaefer wrote:
>Hmm.  "2>& foo" does indeed do so, but "2&> foo" only makes one copy.  Is
>that also expected?

Hmm.  It appears that "2&>" is treated as "2 &>" -- the "&>" isn't
recognised as a redirection operator for the purposes of parsing the
I/O number.

% echo x 2&> foo
% cat foo
x 2
% echo x 2>& foo
x
% cat foo
% 

Curiously enough, bash (2.03.0(1)) does the same thing.

-zefram

Index: ChangeLog
===================================================================
RCS file: /cvsroot/zsh/zsh/ChangeLog,v
retrieving revision 1.27
diff -c -r1.27 ChangeLog
*** ChangeLog	2000/04/06 16:44:02	1.27
--- ChangeLog	2000/04/06 17:16:32
***************
*** 1,5 ****
--- 1,9 ----
+ 2000-04-06  Andrew Main  <zefram@xxxxxxx>
+ 
+ 	* zefram2: Src/lex.c: Support "3&> foo" etc.
+ 
  2000-04-06  Andrew Main  <zefram@xxxxxxx>
  
  	* zefram1: configure.in, Etc/zsh-development-guide: List of tools
  	required for development work, and a little more conspicuous
  	explanation of the config.status hack.
Index: Src/lex.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/lex.c,v
retrieving revision 1.2
diff -c -r1.2 lex.c
*** Src/lex.c	2000/04/04 01:16:25	1.2
--- Src/lex.c	2000/04/06 17:16:33
***************
*** 642,648 ****
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
! 	if (d == '>' || d == '<') {
  	    peekfd = c - '0';
  	    c = d;
  	} else {
--- 642,659 ----
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
! 	if(d == '&') {
! 	    d = hgetc();
! 	    if(d == '>') {
! 		peekfd = c - '0';
! 		hungetc('>');
! 		c = '&';
! 	    } else {
! 		hungetc(d);
! 		lexstop = 0;
! 		hungetc('&');
! 	    }
! 	} else if (d == '>' || d == '<') {
  	    peekfd = c - '0';
  	    c = d;
  	} else {
***************
*** 702,707 ****
--- 713,719 ----
  	else if (d == '!' || d == '|')
  	    return AMPERBANG;
  	else if (d == '>') {
+ 	    tokfd = peekfd;
  	    d = hgetc();
  	    if (d == '!' || d == '|')
  		return OUTANGAMPBANG;
***************
*** 715,721 ****
  	    }
  	    hungetc(d);
  	    lexstop = 0;
- 	    tokfd = -1;
  	    return AMPOUTANG;
  	}
  	hungetc(d);
--- 727,732 ----



Messages sorted by: Reverse Date, Date, Thread, Author