From: Zefram <A.Main@dcs.warwick.ac.uk>
To: zsh-workers@math.gatech.edu (Z Shell workers mailing list)
Subject: Globbing in redirections
Date: Thu, 6 Jun 1996 15:54:30 +0100 (BST) [thread overview]
Message-ID: <6465.199606061454@downwind.dcs.warwick.ac.uk> (raw)
-----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-----
next reply other threads:[~1996-06-06 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-06-06 14:54 Zefram [this message]
1996-06-06 16:25 ` Zoltan Hidvegi
1996-06-06 16:36 ` Zefram
1996-06-06 16:48 ` Zoltan Hidvegi
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=6465.199606061454@downwind.dcs.warwick.ac.uk \
--to=a.main@dcs.warwick.ac.uk \
--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).