Redirection quirks: 2>&1 >file -- vs. -- >file 2>&1
Ipse dixit
ken at rochester.UUCP
Tue Jan 7 02:40:00 AEST 1986
Alright you guys, figure this one out then:
--------------------
->> cat d.c
main()
{
printf("Hello world\n");
if (open("/etc/phones", 2) < 0)
perror("/etc/phones");
}
->> a.out 2>&1 > xxx
/etc/phones: No such file or directory
->> cat xxx
Hello world
->> a.out > xxx 2>&1
->> cat xxx
/etc/phones: No such file or directory
Hello world
->> 2>&1 a.out > xxx
->> cat xxx
/etc/phones: No such file or directory
Hello world
->>
-------------------
What I really want to know is, what *should* it do? I find sh(1) very
uninformative, with some mumble about duplicating file descriptors.
Don't get me wrong, I've used Unix for years, but I find the
explaination in sh(1) so obtuse that I just look at some old sh files
when I want to get work done.
Ken
--
UUCP: ..!{allegra,decvax,seismo}!rochester!ken ARPA: ken at rochester.arpa
Snail: Comp. of Disp. Sci., U. of Roch., NY 14627. Voice: Ken!
More information about the Comp.unix.wizards
mailing list