From: Stu Date: 2013-06-27T14:23:42+09:00 Subject: Re: #!/usr/bin/env: No such file or directory --089e012284fab9cfdd04e01bf6ee Content-Type: text/plain; charset=ISO-8859-1 Well that's embarrassing. It's hash bang... I had reversed it while typing to fast. My apologize. Todd to know more about chmod read the man page: % man chmod It stands for change mode. Basically it's turning on the execute bit when you use +x. ~Stu On Thu, Jun 27, 2013 at 12:13 AM, Stu wrote: > 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/. >> > > --089e012284fab9cfdd04e01bf6ee Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Well that's embarrassing. It's= hash bang... I had reversed it while typing to fast. My apologize.

=
Todd to know more about chmod read the man page:
% man chmod=

It stands for change mode. Basically it's turning on the exec= ute bit when you use +x.

~Stu


On Thu, Jun 27, 2013 at 12:13 AM, St= u <stu@rubyprogrammer.net> wrote:
Hi Todd!

!#/usr/bin/env rub= y

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 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 a= t 10:58 PM, Todd Sterben <lists@ruby-forum.com> wrote:
I am new to both linux and 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/.


--089e012284fab9cfdd04e01bf6ee--