I wasn’t able to run ./script/console previously, and it used to throw an error since my script console file had included #!/usr/bin/env ruby19. After doing hit and trial I fixed this error by replacing #!/usr/bin/env ruby19 with #!/usr/bin/env ruby.
What does the above line do?
Versions:
- Ruby: 1.9.2-p180
- Ruby on Rails: 2.3.5
The
#!(hash bang) in the first line of a text file tells the program loader in most *nix systems to invoke the program that is specified next (in this case,/usr/bin/env) with any params supplied (in this case,ruby)./usr/bin/envis just a portable way of looking in your environment for program named in the first argument. Here it is the Ruby interpreter. If the Ruby interpreter is in your PATH, env will find it and run it using the rest of the file as input.You probably didn’t have a program named
ruby19in your PATH, so you’d get the error. You do have a program namedruby, so that works.