Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!tgr!lcc.richard@UCLA-LOCUS.ARPA From: lcc.richard@UCLA-LOCUS.ARPA (Richard Mathews) Newsgroups: net.unix-wizards Subject: Re: Bourne shell io redirection with <> -- what is it? Message-ID: <10180@brl-tgr.ARPA> Date: Wed, 24-Apr-85 11:19:33 EST Article-I.D.: brl-tgr.10180 Posted: Wed Apr 24 11:19:33 1985 Date-Received: Fri, 26-Apr-85 21:51:15 EST Sender: news@brl-tgr.ARPA Lines: 28 > > Does anyone know what the undocumented <> io redirection metacharacter > > sequence in the bourne shell does? Is it useful? > > What it does: > redirects input from specified file but open() is called > for read/write instead of read only > > Is it useful: > Doubtful Well, I managed to find a use for it. It turns out that "more" tries to READ STDERR! (yucch!), so I wanted to open stderr for read/write. I discovered why this "feature" is undocumented. It does not work. I tried it on the Sys V.2, BSD 4.1, and BSD 4.2 Bourne shells. On all of these it only opened the file for read. I took a look at the shell source. When it sees this construct, it sets a bit, IORDW, in its I/O structure. Unfortunately, this bit never gets tested. When the shell goes to open the file, it will just end up falling into the code it uses for ">filename". As I side issue, if "more" cannot read stderr for any reason other than EINTR, it exits WITHOUT SETTING THE TERMINAL MODES BACK! Richard M. Mathews Locus Computing Corporation lcc!richard@ucla-cs {ucivax,trwrb}!lcc!richard {ihnp4,randvax,sdcrdcf,ucbvax,trwspp}!ucla-cs!lcc!richard