Suppose i have a ruby script that prints some message like Hello World
Now, can i make custom shell command like printMessage which passes the control to my ruby script ?
so that whenever i type printMessage from the command line, it prints Hello World ?
Add this to your .bashrc or .bash_profile
Should do it. Unless I misunderstood the question.
And
putswill print to command line. And you have to reload your bash profile once you’ve done this to get it to work. Just typesource ~/.bashrcto reload it.May have to
chmodthe file.Alternative:
Should work too.