How do I run a Ruby script on Linux and have the name of the script show up in TOP COMMAND instead of Ruby?

T the letter 'c' while top is running, it toggles display between command name and line.

Now that you know how to navigate to your Ruby scripts (or your rb files), it's time to run them. Open your text editor and save the following program as test.rb. Print "What is your name?

Name = gets. Open a command line window and navigate to your Ruby scripts directory using the cd command. Once there, you can list files, using the dir command on Windows or the ls command on Linux or OS X.

Your Ruby files will all have the . Rb file extension. To run the test.

Rb Ruby script, run the command ruby test.rb. The script should ask you for your name and greet you. Alternatively, you can configure your script to run without using the Ruby command.

On Windows, the one-click installer already set up a file association with the . Rb file extension. Simply running the command test.

Rb will run the script. In Linux and OS X for scripts to run automatically two things must be in place: a "shebang" line and the file being marked as executable. The shebang line is already done for you; it's the first line in the script starting with #!.

This tells the shell what type of file this is. In this case it's a Ruby file to be executed with the Ruby interpreter. To mark the file as executable, run the command chmod +x test.rb.

This will set a file permission bit indicating that the file is a program and that it can be run. Now, to run the program simply enter the command . Whether you invoke the Ruby interpreter manually with the Ruby command or run the Ruby script directly is up to you.

Functionally, they are the same thing. Use whichever method you feel most comfortable with.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions