zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: ZSH Users <zsh-users@sunsite.auc.dk>
Subject: Re: tee-like file redirection in shell?
Date: Thu, 10 Jun 1999 03:15:42 +0000	[thread overview]
Message-ID: <990610031542.ZM206@candle.brasslantern.com> (raw)
In-Reply-To: <19990609172916.A17470@astaroth.nit.gwu.edu>

On Jun 9,  5:29pm, Sweth Chandramouli wrote:
} Subject: Re: tee-like file redirection in shell?
}
} On Wed, Jun 09, 1999 at 08:16:39PM +0100, Bruce Stephens wrote:
} > Sweth Chandramouli <sweth@astaroth.nit.gwu.edu> writes:
} > 
} > You need the multios option set, and I don't recall whether it's the
} > default or not (it probably should be).

It's not set by default because of the way it interacts with globbing.
If you do something like

	echo "Create this file" > *

then zsh will write to every file in the current directory (unless the
noclobber option is set).

} > Is there any nicer way to say "save to a file and show the results"
} > than using the ugly "| cat"?
} 
} 	i don't know that it's particularly nicer, but something like
} % ps > some_file > /dev/stdout

In addition to the trick that Geoff mentioned using >&1, zsh interprets
the path /dev/fd/ magically.  So on any operating system, even those that
do not support the /dev/fd/ directory, you can use

	/dev/fd/0	(standard input)
	/dev/fd/1	(standard output)
	/dev/fd/2	(standard error)
	(etc.)

So >/dev/fd/1 is the same as >&1, and so forth, except that with the
/dev/fd/ files the file descriptor must already exist -- it won't be
duplicated from another file descriptor.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


      parent reply	other threads:[~1999-06-10  3:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-09 13:40 Sweth Chandramouli
1999-06-09 13:56 ` Geoff Wing
1999-06-09 19:16 ` Bruce Stephens
1999-06-09 21:29   ` Sweth Chandramouli
1999-06-09 23:10     ` Geoff Wing
1999-06-10  3:15     ` Bart Schaefer [this message]

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=990610031542.ZM206@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=zsh-users@sunsite.auc.dk \
    /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).