Re: Detecting if a pipe exists

2001-08-21 Thread Michael Fowler
On Wed, Aug 22, 2001 at 11:09:13AM +0530, Karthik Krishnamurthy wrote: > wouldn't it be better to check ARGV to see if arguments have been > passed. if input. else read on STDIN. You missed his last example: On Tue, Aug 21, 2001 at 03:44:05PM -0400, Andrew G.McArthur wrote: > cat numbers.list |

Re: Detecting if a pipe exists

2001-08-21 Thread Karthik Krishnamurthy
wouldn't it be better to check ARGV to see if arguments have been passed. if so use that as input. else read on STDIN. /kk On Tue, Aug 21, 2001 at 12:10:22PM -0800, Michael Fowler wrote: > On Tue, Aug 21, 2001 at 03:44:05PM -0400, Andrew G.McArthur wrote: > > > squareroot 100 1000 25 > > > >

RE: Detecting if a pipe exists

2001-08-21 Thread Bob Showalter
> -Original Message- > From: Michael Fowler [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 21, 2001 4:39 PM > To: Bob Showalter > Cc: '[EMAIL PROTECTED]' > Subject: Re: Detecting if a pipe exists > > > On Tue, Aug 21, 2001 at 04:06:11PM -0400, B

Re: Detecting if a pipe exists

2001-08-21 Thread Michael Fowler
On Tue, Aug 21, 2001 at 04:06:11PM -0400, Bob Showalter wrote: > You might use -t to see if STDIN is a tty, but that wouldn't work for > >$ cat >sq.sh >squareroot 100 >$ sh sq.sh # STDIN is a tty, but should I read input? I'm not seeing the purpose behind this example. You'

Re: Detecting if a pipe exists

2001-08-21 Thread Michael Fowler
On Tue, Aug 21, 2001 at 03:44:05PM -0400, Andrew G.McArthur wrote: > > squareroot 100 1000 25 > > > cat numbers.list | squareroot > > > cat numbers.list | squareroot 25 144 > > I've had no problem with the second two examples, but the first waits > for input from the STDIN. How can I get m

RE: Detecting if a pipe exists

2001-08-21 Thread Bob Showalter
> -Original Message- > From: Andrew G.McArthur [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, August 21, 2001 3:44 PM > To: [EMAIL PROTECTED] > Subject: Detecting if a pipe exists > > > Dear all, > > I'm developing a perl program in UNIX that I want t

Detecting if a pipe exists

2001-08-21 Thread Andrew G . McArthur
Dear all, I'm developing a perl program in UNIX that I want to sometimes work on data from the pipe, sometimes from the command line, and sometimes both. For example, consider the hypothetical program "squareroot". I would like to use it in the following three ways from the command prompt: