Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: tee-like file redirection in shell?
- X-seq: zsh-users 2378
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: ZSH Users <zsh-users@xxxxxxxxxxxxxx>
- Subject: Re: tee-like file redirection in shell?
- Date: Thu, 10 Jun 1999 03:15:42 +0000
- In-reply-to: <19990609172916.A17470@xxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19990609094032.A15964@xxxxxxxxxxxxxxxxxxxx> <m3pv35chgo.fsf@xxxxxxxxxxxxxxxxxxxx> <19990609172916.A17470@xxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author