# Article on oreilly.net on how to build Unix tools with Ruby

**URL:** <https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163>\
**Category:** ruby-talk\
**Created:** [19 September 2003 21:00 UTC](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163 "2003-09-19T21:00:21Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![Mike\_Stok](https://avatars.discourse-cdn.com/v4/letter/m/50afbb/32.png) [@Mike\_Stok](https://rubytalk.org/u/Mike_Stok)\
**Post date:** [24 September 2003 11:18 UTC](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163/21 "2003-09-24T11:18:42Z")

</div>

In article [20030923200517.A36392@freeze.org](mailto:20030923200517.A36392@freeze.org),

> > - Gavin Sinclair [gsinclair@soyabean.com.au](mailto:gsinclair@soyabean.com.au) [2003-09-23 17:16]:
> > 
> > > > 1. I wish he’d mentioned the option of using #!/usr/bin/env ruby  
> > > > instead of #!/usr/local/bin/ruby.
> > > 
> > > Can someone please explain to me what /usr/bin/env/ruby does?
> 
> Speaking of env, does this work on linux when options are passed  
> to ruby?
> 
> I’m not at a linux terminal right now, but when the shebang is:
> 
> /usr/bin/env ruby -w
> 
> I get the error that ruby -w is not found.  
> The gnu manual says that it should work, but it certainly  
> doesn’t work as it does on FreeBSD or Sun.

One way of getting arounf env’s ignoring ARGS iff you are just doing -w  
is to put

$VERBOSE = true

after the shebang line. See  
[http://mail.gnu.org/archive/html/bug-sh-utils/2002-04/msg00020.html](http://mail.gnu.org/archive/html/bug-sh-utils/2002-04/msg00020.html)  
for an explanation.

Hope this helps,

Mike

> **···**
>
> Jim Freeze [jim@freeze.org](mailto:jim@freeze.org) wrote:
> 
> > On Wednesday, 24 September 2003 at 8:24:36 +0900, Michael W Thelen wrote:
> > 
> > > > On Wednesday, September 24, 2003, 2:33:01 AM, Paul wrote:
> 
> –  
> [mike@stok.co.uk](mailto:mike@stok.co.uk) | The “`Stok’ disclaimers” apply.  
> [http://www.stok.co.uk/~mike/](http://www.stok.co.uk/~mike/) | GPG PGP Key 1024D/059913DA  
> [mike@exegenix.com](mailto:mike@exegenix.com) | Fingerprint 0570 71CD 6790 7C28 3D60  
> [http://www.exegenix.com/](http://www.exegenix.com/) | 75D2 9EC4 C1C0 0599 13DA

---

<div class="post-metadata">

**Author:** ![Gavin\_Sinclair](https://avatars.discourse-cdn.com/v4/letter/g/db5fbb/32.png) [@Gavin\_Sinclair](https://rubytalk.org/u/Gavin_Sinclair)\
**Post date:** [24 September 2003 22:20 UTC](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163/22 "2003-09-24T22:20:04Z")

</div>

> Hal Fulton wrote: (re: runix)  
> .
> 
> > Finally I decided: It’s an interesting and fun activity, but it’s not  
> > a high priority for me. I myself am rapidly moving away from Windows,  
> > and it’s not usually wise to invest in the past.

> Then think of it as an investment in the future. Just as you leave one  
> OS for another today, you may do the same in the future, even if going  
> from one flavor of \*nix to another. I’ve run into assorted iratation  
> because different 'nix do not implement all utilities quite the same  
> way. Whether it be grep with slighly different switches, or some  
> version of ifconfig, or whatever, it’s nice to have a known set of tools  
> that Do The Right Thing wherever they are.

The GNU utilities?

> […]

Gavin

> **···**
>
> On Thursday, September 25, 2003, 4:57:35 AM, James wrote:

---

<div class="post-metadata">

**Author:** ![David\_Garamond2](https://avatars.discourse-cdn.com/v4/letter/d/8dc957/32.png) [@David\_Garamond2](https://rubytalk.org/u/David_Garamond2)\
**Post date:** [25 September 2003 04:32 UTC](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163/23 "2003-09-25T04:32:05Z")

</div>

Gavin Sinclair wrote:

> > The aim at the time was to implement a free set of Unix-like tools  
> > for Windows (without the heavyweight solution of Cygwin).
> 
> There are other (lightweight) solutions anyway: mingw and unixtools.  
> I see no point in a Ruby project for this; it doesn’t solve any  
> problems that I’ve seen come up on the list.

Of course the main reason for Perl Power Tools, Runix, rpt, etc. would  
be only-for-fun hacking (or, in Perl lingo, “hubris”). After all, when  
Ruby is available in a platform, wouldn’t a C compiler be too?

Also, most of the Unix tools are already established and the  
fast-to-prototype-and-change nature of Ruby wouldn’t help much here.

> **···**
>
> –  
> dave

---

<div class="post-metadata">

**Author:** ![Jim\_Freeze2](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@Jim\_Freeze2](https://rubytalk.org/u/Jim_Freeze2)\
**Post date:** [24 September 2003 13:13 UTC](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163/24 "2003-09-24T13:13:47Z")

</div>

Yes, that is our current work around. It’s probably the better  
convention because it is reliable for all platforms.

> **···**
>
> On Wednesday, 24 September 2003 at 20:18:42 +0900, Mike Stok wrote:
> 
> > In article [20030923200517.A36392@freeze.org](mailto:20030923200517.A36392@freeze.org),
> > 
> > > I get the error that ruby -w is not found.  
> > > The gnu manual says that it should work, but it certainly  
> > > doesn’t work as it does on FreeBSD or Sun.
> > 
> > One way of getting arounf env’s ignoring ARGS iff you are just doing -w  
> > is to put
> > 
> > $VERBOSE = true
> > 
> > after the shebang line. See
> 
> ## – Jim Freeze
> 
> All things are possible, except skiing thru a revolving door.

[Previous page](https://rubytalk.org/t/article-on-oreilly-net-on-how-to-build-unix-tools-with-ruby/8163.md?page=1)
