Forum: Ruby Pipe shell output to ruby -e?

E2b3bbf241a5daee3ee7696a7d4b2015?d=identicon&s=25 Vrtwo Lastname (d0t1q)
on 2006-10-22 09:17
(Received via mailing list)
I know this has been done before but search yields nothing :-\

Just wondering how you can pipe output to ruby -e?  I tried this but
it doesnt work :-(

#### borked
echo "hello" |ruby -e 'puts ARGV.to_s'



Thanks for any help you may be able to offer.
4feed660d3728526797edeb4f0467384?d=identicon&s=25 Bill Kelly (Guest)
on 2006-10-22 09:58
(Received via mailing list)
From: "x1" <caldridge@gmail.com>
>
> Just wondering how you can pipe output to ruby -e?  I tried this but
> it doesnt work :-(
>
> #### borked
> echo "hello" |ruby -e 'puts ARGV.to_s'

A couple possibilities:

  echo hello | ruby -e "puts gets"
  echo hello | ruby -e "puts ARGF.read"

  ruby -e 'puts ARGV.to_s' `echo hello`


Hope this helps,

Bill
E8a964c61e14504ff3b64f61ad18a049?d=identicon&s=25 EB (Guest)
on 2006-10-22 15:10
(Received via mailing list)
x1 wrote:
> I know this has been done before but search yields nothing :-\
>
> Just wondering how you can pipe output to ruby -e?  I tried this but
> it doesnt work :-(
>
> #### borked
> echo "hello" |ruby -e 'puts ARGV.to_s'

   echo "hello" | xargs ruby -e 'puts ARGV.to_s'

will also work.

Cheers,

eb
E2b3bbf241a5daee3ee7696a7d4b2015?d=identicon&s=25 Vrtwo Lastname (d0t1q)
on 2006-10-23 06:30
(Received via mailing list)
Awesome. Thanks so much!
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.