ruby pipe with arguments error

C

cap

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
 
N

nobuyoshi nakada

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top