Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mcvax!cernvax!cgcha!wtho From: wtho@cgcha.UUCP (Tom Hofmann) Newsgroups: comp.unix.questions Subject: Shell escapes within piped programs Message-ID: <510@cgcha.UUCP> Date: Tue, 18-Aug-87 11:45:17 EDT Article-I.D.: cgcha.510 Posted: Tue Aug 18 11:45:17 1987 Date-Received: Thu, 20-Aug-87 04:23:23 EDT Organization: CIBA-GEIGY AG, FO/WIRZ/WRZ, CH-4002 Basel, Switzerland Lines: 29 Keywords: shell pipe I've just had a strange experience with shell escapes within piped programs. E.g. I called ls | more and typed !mail
at the "more" prompt. But instead of being prompted for "Subject:" and entering text (as I expected), the rest of the listing to be displayed was mailed to
, and the "more" prompt returned. The reason, as I think, is that standard input of "more" is not the terminal but the pipe, and therefore the standard input of the invoked program is that pipe as well. Therefore "mail" reads from the pipe and not from the terminal. I tried it both on a SUN and a CADMUS and got the same (strange) result. I made another test using "pg" (System V) instead of "more", and this time I got the expected behavior on both machines. My question: Shouldn't shell escapes redirect the input (and output) to the terminal? Tom Hofmann CIBA-GEIGY AG Scientific Computer Center P.O. Box Tel. +41 61 372059 CH-4002 Basel Switzerland uucp: ...!mcvax!cgcha!wtho