Using the cw command line executable.

Running cw

In addition to running your cw scripts by typing:

ruby script.rb

CW also provides an executable called cw, which can be used instead.

The cw command also provides additional functionality, making it easy to run several scripts in a row, and / or repeat a single or multiple scripts several times.

cw command format

In its simplest form, the cw command is used as follows:

cw script_name.rb

Alternatively the script extension may be left off altogether (so long as the extension is .rb):

cw script_name

Run multiple scripts

It is also possible to call multiple scripts to be run one after the other. In this case the scripts to run are seperated by whitespace:

cw script_1 script_2

Run a script or multiple scripts more than once.

If the last argument supplied to cw is a number, the preceding script or scripts will be repeated.

For example, the following command will run script.rb twice:

cw script.rb 2

Here we will run script_1.rb and script_2.rb three times. Notice the extensions aren’t supplied:

cw script_1 script_2 3