how could I run a ruby script as a command in linux.
I have this script which access the lib but i have to run it as
teraData.rb
i want to run it as teradata (or some meaningful command ) with args on linux from any command promt.
Where should i place the script and what should I do?
I am kinda new to linux so please help
If the script is executable and the first line of the script is
#!/usr/bin/ruby(or whatever the path to your ruby interpreter might be), then you should be able to launch the script directly (i.e.$ ./myscript.rb).Otherwise, execute the interpreter and pass it the script as an argument (
ruby ./myscript.rb).If you want to run the script from anywhere using a simple command, wrap one of these methods in a bash function like so:
Place this function definition in your
.bashrcfile to have it automatically loaded whenever you open a shell.