$ cat ./rubytest.rb
#!/usr/bin/env ruby
STDOUT << STDIN.gets
[matte...@matt-aimonettis-macbook tmp]$ echo 'test 42' | ./rubytest.rb
test 42

- Matt

On Sat, Dec 19, 2009 at 12:31 AM, Greg Willits <[email protected]> wrote:

> I need to do a couple quick little utility scripts which pipe the
> result of a shell command into a Ruby script.
>
> For example, I imagined it would look like this:
>
>    my_utility.rb | head -n 1 file_name.txt
>
> where the ruby script can be as simple as this just to get a working
> skeleton:
>
>   #!/usr/bin/env ruby
>   p ARGV
>
> But with that syntax I get a "broken pipe" error.
>
> I've googled and tried a few things, but no go. It has to be something
> really simple I am missing.
>
> -- gw
>
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to