Linux command for a ruby script -


How can I run a Ruby script as a command in Linux?

I have this script which is accessible Lib but I have to run it

teraData.rb

I will call it on Linux from any command prompt I want to run as a terredata (or some meaningful command).

Where should I put the script and what should I do?

I'm new to Linux so please

If the script is executable and the script First line of #! / Usr / bin / ruby ​​ (or whatever path might be for your Ruby interpreter), then you should be able to launch the script directly (i.e. $ ./myscript .rb ).

Otherwise, execute the interpreter and pass the script as an argument ( ruby ​​./myyscript.rb ).

If you want to run the script anywhere using a simple command, then wrap one of these methods in the bash function:

  function from RData {Ruby / Path / To / Script / Eradata RB $ *}  

Load this function in your .bashrc file automatically load whenever you open a shell.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -