ch

Changes the host where subsequent commands run.

Synopsis

ch [-S] [-t] [host_name]
ch [-h | -V]

Description

The ch command has the following default behavior:
  • If no arguments are specified, changes the current host to the home host, the host from which the ch command was issued.
  • Runs commands on the home host.
  • Shell mode support is not enabled.
  • Does not display run time of tasks.

Use the ch command to quickly change to a designated host with the same execution environment. A simple shell is started that delivers all subsequent commands (except built-in commands) to the designated host for execution.

When the simple shell starts, it is in the current working directory and has the same command execution environment as the parent shell. Every remotely dispatched command is run with the same environment as on the home host. The syntax of the ch command is similar to the Bourne shell with some important differences.

The ampersand (&) character that follows a command represents a background job in the Bourne shell. The ampersand (&) character is ignored by the ch command. You can submit background jobs with the ch command with the built-in post command and bring them into the foreground with the built-in contact command.

The ch command recognizes a tilde (~) as a special path name. If a tilde is followed by white space (space, tab, new line or slash (/) character, the ~ character is represents the user’s home directory. Otherwise, the ~ represents the home directory of the user name that is given by the string that follows the ~ character. Pipes, lists of commands and redirection of standard input and standard output are all handled by running the /bin/sh command.

The following sequence of commands illustrates the behavior of the ch command. For example, the user is on hostA:
ch hostB
hostB> ch hostC
hostC> ch
hostA> ... ...

Options

-S
Starts remote tasks with shell mode support. Shell mode support is required for running interactive shells or applications that redefine the CTRL-C and CTRL-Z keys (for example, jove).
-t
Turns on the timing option. The amount of time each subsequent command takes to run is displayed.
host_name
Runs subsequent commands on the specified host.
-h
Prints command usage to stderr and exits.
-V
Prints LSF release version to stderr and exits.

Usage

The ch command interprets the following built-in commands:

cd [directory_name]
Changes the current working directory to the specified directory. If a directory is not specified, changes to the user’s home directory by default.
ch [host_name]
Changes the current working host to the specified host. If a host is not specified, changes to the home host by default.
post [command [argument ...]]
Posts the specified command for execution in the background on the current working host. The ch command assigns a unique task ID to this command and displays the ID. The ch command continues to interact with the user. However, the output of background jobs might disturb the screen. You can post multiple commands on one host or on different hosts. When a previously posted command is completed, the ch command reports its status to standard error. If a command is not specified, the ch command displays all running background commands.
contact task_ID
Brings a previously posted background command into the foreground. The task ID (task_ID) is the ID returned by the post command. Standard input is passed to this foreground command. You cannot put an active foreground job into the background. A command that was brought into the foreground with the contact command cannot be put back into the background.
exit
Exits the ch command if no posted commands are running. Typing an EOF character (usually CTRL-D but can be set otherwise, see stty) forces the ch command to exit. Posted commands that are not completed are killed.

Limitations

The ch command does not support script, history, or alias.

The ch command shows the following prompt: current_working_host:current_working_directory>. If the ch session is invoked by a shell that supports job control (such as tcsh or ksh), CTRL-Z suspends the ch session. The exit status of a command line is printed to stderr if the status is nonzero.

See also

lsrun, rsh, stty