Forum: Ruby ruby pipe with arguments error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
capitain (Guest)
on 2005-12-08 06:18
(Received via mailing list)
i am newbie of ruby , but i met a strange problem
when  use
--------------------------------
#echo hello |ruby -ve 'puts ARGF.readlines'
ruby 1.8.3 (2005-09-21) [i686-linux]
hello
--------------------------------
it's ok

but when i append a argument with pipe
--------------------------------
# echo hello |ruby -ve 'puts ARGF.readlines' somearg
ruby 1.8.3 (2005-09-21) [i686-linux]
-e:1:in `readlines': No such file or directory - somearg
(Errno::ENOENT)
        from -e:1
--------------------------------

why ruby say 'no such file or diectory'? can anyboby explain it?

thanks
nobuyoshi.nakada (Guest)
on 2005-12-08 09:37
(Received via mailing list)
Hi,

At Thu, 8 Dec 2005 13:17:35 +0900,
cap wrote in [ruby-talk:169506]:
> why ruby say 'no such file or diectory'? can anyboby explain it?

ARGF doesn't equal STDIN.

Quotation from the document:
 *  The global constant ARGF (also accessible as $<) provides an
 *  IO-like stream which allows access to all files mentioned on the
 *  command line (or STDIN if no files are mentioned).
This topic is locked and can not be replied to.