Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Globbing in redirections
- X-seq: zsh-workers 1276
- From: Zefram <A.Main@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: Globbing in redirections
- Date: Thu, 6 Jun 1996 15:54:30 +0100 (BST)
-----BEGIN PGP SIGNED MESSAGE-----
This patch makes redirection behave a little more like ksh.
It disables globbing on filenames in redirections, but only when
multios are disabled. (Globbed redirections are a very useful way
to generate multios.) Note that behaviour is still not exactly
like ksh, as brace expansion is still done. But ksh seems to treat
brace expansion as part of globbing: compare "echo ~{root,nobody}"
in the two shells. (KSH_BRACES, anyone?)
This patch as written relies on my recent large options patch,
that changed the NO_MULTIOS option into MULTIOS. If you haven't
applied that, change "isset(MULTIOS)" to "unset(NOMULTIOS)".
-zefram
Index: Doc/zshmisc.man
*** zshmisc.man 1996/06/06 01:45:20 1.5
--- zshmisc.man 1996/06/06 02:05:26
***************
*** 512,517 ****
--- 512,532 ----
.PP
writes the date to the file "foo", and also pipes it to cat.
.PP
+ If the
+ .B MULTIOS
+ option is set, the word after a redirection operator is also subjected
+ to filename generation (globbing). Thus
+ .RS
+ .PP
+ .B : > *
+ .RE
+ .PP
+ will truncate all files in the current directory,
+ assuming there's at least one.
+ (Without the
+ .B MULTIOS
+ option, it would create an empty file called "*".)
+ .PP
If the user tries to open a file descriptor for reading more than once,
the shell opens the file descriptor as a pipe to a process that copies
all the specified inputs to its output in the order
Index: Src/glob.c
*** glob.c 1996/06/06 01:45:30 1.8
--- glob.c 1996/06/06 02:06:51
***************
*** 862,868 ****
addlinknode(fake, fn->name);
/* ...which undergoes all the usual shell expansions. */
prefork(fake, 0);
! if (!errflag)
globlist(fake);
if (errflag)
return 0;
--- 862,869 ----
addlinknode(fake, fn->name);
/* ...which undergoes all the usual shell expansions. */
prefork(fake, 0);
! /* Globbing is only done for multios. */
! if (!errflag && isset(MULTIOS))
globlist(fake);
if (errflag)
return 0;
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMbY/BHD/+HJTpU/hAQFX1AP8DZcutSWVln2VufviHDskuXPr5MbP5wTi
S2YhTOYPCQ/JCfh2BeQTZXw/k/TNM5vSQC7EawulBEOB42ClMQJdo5IRrReh0HUP
tQNptWP7YVm879YKHp26ka8vl2tmrcqC0J0M3mEqAEFQ124AMRvsJ4cG1bOV1vDz
BiZusin6gj4=
=kDm+
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author