Pipe shell output to ruby -e?

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 :frowning:

borked

echo “hello” |ruby -e ‘puts ARGV.to_s’

Thanks for any help you may be able to offer.

From: “x1” [email protected]

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

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

Awesome. Thanks so much!

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 :frowning:

borked

echo “hello” |ruby -e ‘puts ARGV.to_s’

echo “hello” | xargs ruby -e ‘puts ARGV.to_s’

will also work.

Cheers,

eb