From: Stu Date: 2013-06-27T14:13:56+09:00 Subject: Re: #!/usr/bin/env: No such file or directory --089e011618dcf4c54304e01bd34a Content-Type: text/plain; charset=ISO-8859-1 Hi Todd! !#/usr/bin/env ruby it needs the token (i.e. program executable name) in front of the env token. This makes your script portable. You will want to make it exectutable which is done with the command chmod like so: % chmod +x /path/to/your-program from there to exectute it you can do it one of three ways. 1. simply use dot slash in front of the program like: ./prog 2. type the whole path like: /home/todd/prog 3. set up a bin directory and set up your the PATH variable in your shells rc file. The last one is your homework =) With that you can just run your script from anywhere and even incorporate it into other scripts and so on. Congratulations and welcome to the wonderful world of UNIX and Ruby Programming =) Oh and one last word of advice. AUTOMATE EVERYTHING! ~Stu (15 years hacking shells networks and BSDs and GNUs ) On Wed, Jun 26, 2013 at 10:58 PM, Todd Sterben wrote: > I am new to both linux and ruby. I am using Ubuntu and Ruby 1.9 > > When I do which ruby, I get /usr/bin/ruby > When I do ruby -v I get ruby 1.9.3p0 (2011-10-30 revision 33570) > [i686-linux] > > When I try to kick off a simple script > > #!/usr/bin/env > > puts "Hello" > > I get > > ./test.rb: line 1: #!/usr/bin/env: No such file or directory > ./test.rb: line 4: puts: command not found > > > Why? > > Thanks > > Todd > > -- > Posted via http://www.ruby-forum.com/. > --089e011618dcf4c54304e01bd34a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Todd!=

!#/usr/bin/env ruby

it needs the token (i.e. program e= xecutable name) in front of the env token. This makes your script portable.=

You will want to make it exectutable which is done with the comma= nd chmod like so:

% chmod +x /path/to/your-program

from there to exectute it you can do it one of three ways.

1. simply use dot slash in front of the program like: ./prog
2. ty= pe the whole path like: /home/todd/prog
3. set up a bin directory = and set up your the PATH variable in your shells rc file.

The last one is your homework =3D) With that you can just run your script=20 from anywhere and even incorporate it into other scripts and so on.

=
Congratulations and welcome to the wonderful world of UNIX and Ruby P= rogramming =3D)
Oh and one last word of advice. AUTOMATE EVER= YTHING!

~Stu (15 years hacking shells networks and BSDs and GN= Us )

=



On Wed, Jun 26, 2013 at 10:58 PM, Todd S= terben <lists@ruby-forum.com> wrote:
I am new to both linux an= d ruby. =A0I am using Ubuntu and Ruby 1.9

When I do which ruby, I get /usr/bin/ruby
When I do ruby -v I get ruby 1.9.3p0 (2011-10-30 revision 33570)
[i686-linux]

When I try to kick off a simple script

#!/usr/bin/env

puts "Hello"

I get

./test.rb: line 1: #!/usr/bin/env: No such file or directory
./test.rb: line 4: puts: command not found


Why?

Thanks

Todd

--
Posted via http://= www.ruby-forum.com/.

--089e011618dcf4c54304e01bd34a--