Xref: utzoo alt.sources:176 comp.os.minix:2582 Path: utzoo!mnetor!uunet!ncc!alberta!att-ih!ttrdc!levy From: levy@ttrdc.UUCP (Daniel R. Levy) Newsgroups: alt.sources,comp.os.minix Subject: Re: Public Domain version of: yes(1) Message-ID: <2582@ttrdc.UUCP> Date: 14 Apr 88 02:19:47 GMT References: <2606@bsu-cs.UUCP> Organization: AT&T, Skokie, IL Lines: 25 Keywords: Free Software Summary: yes In article <2606@bsu-cs.UUCP>, dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: > > rm < /dev/yes > > Pipes are well-known to be inefficient, and it makes no sense to create > a new yes process when /dev/yes would be so much faster. PIPES! Why didn't I think of that before. It's easy to kludge a "/dev/yes" capability on systems that support named pipes; just put something like this in the system startup script: if [ ! -p /dev/yes ]; then /etc/mknod /dev/yes p; fi # create a FIFO chown root /dev/yes chmod 644 /dev/yes sh -c 'while :; do while :; do echo y; done >/dev/yes; done' & Since the process is already running, and echo and ':' are shell builtins, there is little overhead. The nested loop is required since the inner loop dies with EPIPE (broken pipe) whenever a process reading from /dev/yes is killed, dies, or closes its file descriptor open onto the pipe. -- |------------Dan Levy------------| Path: ..!{akgua,homxb,ihnp4,ltuxa,mvuxa, | an Engihacker @ | }!ttrdc!ttrda!levy | AT&T Data Systems Group | Disclaimer? Huh? What disclaimer??? |--------Skokie, Illinois--------|