[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby pipe with arguments error

cap

12/8/2005 4:14:00 AM

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

1 Answer

Nakada, Nobuyoshi

12/8/2005 7:34:00 AM

0

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).

--
Nobu Nakada