Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!joshi From: joshi@motcid.UUCP (Abhay B. Joshi) Newsgroups: comp.unix.shell Subject: Output redirection Keywords: stderr stdout Message-ID: <4859@graphite20.UUCP> Date: 18 Oct 90 21:44:03 GMT Organization: Motorola Inc., Cellular Infrastructure Div., Arlington Heights, IL Lines: 29 Hello Netters, Following is a small C program. -----------begin------- #include main() { fprintf(stdout,"Some People\n") ; fprintf(stderr,"Are In\n") ; fprintf(stdout,"Very \n") ; fprintf(stderr,"Deep\n") ; fprintf(stdout,"Trouble\n") ; } -----------end--------- Try to compile and execute it in the following ways: % a.out # prints "Some People Are In Very Deep Trouble" % a.out >tmp 2>&1 % cat tmp # prints "Are In Deep Some People Very Trouble" Sorry, I have removed the newlines between the words. But the sequence is of importance. Is there a way to keep the sequence the same, while using o/p redirection ? Thanks. Abhay Joshi uunet!motcid!joshi