Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!bu-cs!oliveb!mipos3!omepd!merlyn From: merlyn@iwarp.intel.com (Randal Schwartz) Newsgroups: comp.unix.questions Subject: Re: Bourne shell question Keywords: pipe, logical 'or' and " pg ". Message-ID: <5041@omepd.UUCP> Date: 12 Oct 89 04:13:14 GMT References: <1943@sactoh0.UUCP> Sender: news@omepd.UUCP Reply-To: merlyn@iwarp.intel.com (Randal Schwartz) Distribution: usa Organization: Stonehenge; netaccess via Intel, Hillsboro, Oregon, USA Lines: 24 In article <1943@sactoh0.UUCP>, jak@sactoh0 (Jay A. Konigsberg) writes: | | I have a small shell script that I can't get quite right. What it | is supposed to do is list subdirectories or the message "There are | no subdirectories". The script is as follows: | | ls -l | grep "^d" | pg || echo "There are no subdirectories" | | When the pipe into " pg " is removed it works ok, but I would like | to keep the pg in the script. Cheat. Try something like: (ls -l | grep "^d" || echo "There are no subdirectories") | pg 'course, this puts "There are no.." through the pg, but who cares? I said it was cheating. Nope, I can't do it in Perl any shorter. :-) -- /== Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ====\ | on contract to Intel's iWarp project, Hillsboro, Oregon, USA, Sol III | | merlyn@iwarp.intel.com ...!uunet!iwarp.intel.com!merlyn | \== Cute Quote: "Welcome to Oregon... Home of the California Raisins!" ==/