From: wconrad@... Date: 2002-05-09T06:39:52+09:00 Subject: Re: Want application to read file or from pipe On Thu, May 09, 2002 at 06:17:04AM +0900, Jim Freeze wrote: > Hi: > > Does anyone have a sample application that can read > a file given on the commandline or read from a pipe. > I am interested in how one would recognize the difference > from the command-line and how the internal file handling > would change. Read from $< like so: wconrad@pluto:~/foo$ cat foo.rb #!/usr/bin/ruby p $<.read wconrad@pluto:~/foo$ ./foo.rb bar baz "bar\nbaz\n" wconrad@pluto:~/foo$ ./foo.rb foo.rb "#!/usr/bin/ruby\np $<.read\n"