Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!ginosko!uunet!hrtix!davr From: davr@hrtix.UUCP (David C. Raines) Newsgroups: comp.unix.questions Subject: Re: Bourne shell question Summary: Solution Keywords: pipe, logical 'or' and " pg ". Message-ID: <256@hrtix.UUCP> Date: 12 Oct 89 15:03:03 GMT References: <1943@sactoh0.UUCP> Reply-To: davr@hrtix.UUCP (David C. Raines) Distribution: usa Organization: Treasure Chest Advertising, Windsor Locks, CT Lines: 21 In article <1943@sactoh0.UUCP> jak@sactoh0.UUCP (Jay A. Konigsberg) writes: > >I have a small shell script that I can't get quite right. What it >ls -l | grep "^d" | pg || echo "There are no subdirectories" pg returns 'exit 0' whether there is any input or not, so the second half of the 'or' is never executed. The following should do what you intended, with the minor glitch that the 'no subdirectories' message also ends in a page 'EOF:' prompt. (ls -l | grep "^d" || echo "There are no subdirectories") | pg Or you could write a more complex script that saved $? from the grep command, etc. > >Thanks to all who respond. You are welcome. -- David Raines TCA 5 National Dr., Windsor Locks, CT 06096 UUCP: ...!uunet!hrtix!davr