Reputation: 83
It is possible to put the #!/usr/bin/env ruby
at the top and run chmod +x myProgram.rb
to run it from the terminal by doing something like ./myProgram.rb
.
This requires the path to the .rb
file. I am trying to run the program by just typing myProgram
into a terminal.
Upvotes: 0
Views: 132
Reputation: 4657
Adding an alternative that I tend to prefer. Instead of balooning my PATH
variable, I put a single folder such as ~/bin
in my PATH
. Then I create symlinks from here to any executables I have in odd locations. E.g. ln -s /path/to/myProgram.rb ~/bin/myProgram.rb
Upvotes: 1
Reputation: 286
You need to add the directory to the PATH variable. When you type a command in *nix, it tries to look up the command in all the directories in PATH.
Here is a random article explaning how https://opensource.com/article/17/6/set-path-linux.
Upvotes: 0