[CentOS] /bin/env

Bill Campbell centos at celestial.com
Fri Dec 10 19:27:44 UTC 2010


On Fri, Dec 10, 2010, James B. Byrne wrote:
>Please forgive my ignorance but I need a explanation of how to
>accomplish the following since I cannot figure it out from the
>documents.
>
>I have a Ruby script with a shebang line that looks like this:
>
>#!/usr/bin/env ruby
>
>On one particular host I have two Ruby interpreters installed; one
>the CentOS base version 1.8.6 in /usr/bin/ruby the other version
>1.8.7 in /usr/local/bin/ruby.  In my shell the which command finds
>/usr/local/bin/ruby.  In a cron job the /usr/bin/ruby is used by the
>/bin/env invocation.
>
>My question is: How does one configure /bin/env to return the
>/usr/local/bin/ruby version?  or does that question even make sense?

The /bin/env command uses the $PATH environment variable to find
the argument.  If you want to invoke a specific version of ruby,
change the PATH variable or replace this with:

#!/usr/local/bin/ruby

Bill
-- 
INTERNET:   bill at celestial.com  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
Voice:          (206) 236-1676  Mercer Island, WA 98040-0820
Fax:            (206) 232-9186  Skype: jwccsllc (206) 855-5792

A paranoid is a man who knows a little of what's going on.
		-- William S. Burroughs



More information about the CentOS mailing list