Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/3/84; site talcott.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!sdcsvax!dcdwest!ittvax!decvax!genrad!wjh12!talcott!kendall From: kendall@talcott.UUCP (Sam Kendall) Newsgroups: net.unix-wizards Subject: Re: How should command substitution (`...`) work? Message-ID: <163@talcott.UUCP> Date: Tue, 4-Dec-84 13:56:47 EST Article-I.D.: talcott.163 Posted: Tue Dec 4 13:56:47 1984 Date-Received: Sat, 8-Dec-84 04:49:21 EST References: <332@stcvax.UUCP> Organization: Sociology Dept., Harvard Univ. Lines: 32 > Today I was looking for some old news articles. I cd'ed to > the appropriate news directory and typed: > > p `egrep -l pattern *` > > If you aren't familiar with it, "p" is a program from Kernighan > & Pike that displays a screen of text and waits for the user to type > RETURN before displaying the next screen. > > As it turned out, the pattern wasn't found in any of the > articles. Egrep returned a non-zero status without printing any > file names. The shell then ran "p" without any arguments. "p" of > course just sat there for a long time waiting for me to type something. > . . . . > > It seems more natural to me that the shell should (silently) not > run a pipeline if any command substitutions in it fail. Speaking in a sort of Pikeian mode, I think the root of the problem is the tradition of UNIX-style programs to take input from files if given one or more filenames as args, but to take input from stdin if given no arg. If n args means take input from n files, n should be allowed to be 0 (which would mean no input at all), and the "-" argument should mean stdin. Perhaps then it would be reasonable for shell patterns to yield nothing if there was no match, as I theorize that God intended it. It's a little late for UNIX on this point, but for future command interpreters and argument conventions . . . . Sam Kendall {allegra,ihnp4,ima,amd}!wjh12!kendall Delft Consulting Corp. decvax!genrad!wjh12!kendall