cmd
cmd(options)
public
Send a command to the host.
More exactly, sends a string to the host, and reads in all received data until is sees the prompt or other matched sequence.
If a block is given, the received data will be yielded to it as it is read in. Whether a block is given or not, the received data will be return as a string. Note that the received data includes the prompt and in most cases the host’s echo of our command.
options is either a String, specified the string or command to send to the host; or it is a hash of options. If a hash, the following options can be specified:
the command or other string to send to the host. | |
Match |
a regular expression, the sequence to look for in the received data before returning. If not specified, the Prompt option value specified when this instance was created will be used, or, failing that, the default prompt of /[$%#>] z/n. |
the seconds to wait for data from the host before raising a Timeout error. If not specified, the Timeout option value specified when this instance was created will be used, or, failing that, the default value of 10 seconds. |
The command or other string will have the newline sequence appended to it.