greg wrote: > I wanted the ability to optionally pipe a file, but the program would > not require a file to be piped or given as an argument. I guess the > answer is that this cannot be done. I can only allow an optional file > argument, not a pipe. But you can have both, it's done all the time. As has been explained, if the first argument is a file name, you open the file, If the first argument is a dash, this is your signal to read from STDIN. This is a classical arrangement and it plays well with cron, because the program relies completely on its explicit arguments, not stream tests. --------------------------------------- #!/usr/bin/ruby -w data = "" if ARGV if ARGV[0] == '-' data = STDIN.read elsif FileTest.exists? ARGV[0] data = File.read(ARGV[0]) end end puts data --------------------------------------- -- Paul Lutus http://www.arachnoid.com