All Manuals > Editor User Guide > 3 Command Reference

3.34 Running shell commands

The editor allows both single shell commands to be executed and also provides a means of running a shell interactively.

3.34.1 Running shell commands directly from the editor

Shell Command Editor Command

Arguments: command
Key sequence: Meta+! command

The command Shell Command runs the console (shell) command command. The output from the command is displayed in a Shell Output buffer.

A prefix argument causes the output from the shell command to be sent to the *terminal-io* stream rather than the Shell Output buffer.

Shell Command on Region Editor Command

Arguments: command
Key sequence: Meta+| command

The command Shell Command On Region runs the console (shell) command command with the text in the current region as input (by redirection of the standard input), and shows the output.

Without a prefix argument, the output is inserted into the Shell Output buffer (which is created if it does not exist). With a prefix argument, the contents of the region are replaced by the output.

Run Command Editor Command

Arguments: command
Key sequence: None

Executes the single shell command command in a Shell window. When the command terminates, the subprocess is closed down.

3.34.2 Invoking and using a Shell tool

See also the history commands in 3.33 Execute mode.

Shell Editor Command

Arguments: None
Key sequence: None

Opens a Shell window which allows the user to run a shell interactively.

The major mode of the buffer is Shell mode - the variables and key bindings described in this section apply. The minor mode of the buffer is Execute mode so the history key bindings (see 3.33 Execute mode) can also be used in the Shell window.

Whenever the working directory is changed within the shell, the editor attempts to keep track of these changes and update the default directory of the Shell buffer. When a shell command is issued beginning with a string matching one of the editor variables shell-cd-regexp, shell-pushd-regexp or shell-popd-regexp, the editor recognizes this command as a change directory command and attempt to change the default directory of the Shell buffer accordingly. If you have your own aliases for any of the shell change directory commands, alter the value of the appropriate variable. For example, if the value of shell-cd-regexp is "cd" and the shell command cd ~programs/lisp is issued, the next time the editor command Wfind File is issued, the default directory offered is ~programs/lisp. If you find that the editor has not recognized a change directory command then the editor command cd may be used to change the default directory of the buffer.

*shell-shell* Variable

This variable overrides the default shell used for Shell tools. It defaults to nil, which causes the shell to be chosen as documented in 24.4 Configuring the shell to run in the LispWorks IDE User Guide.

Remote Shell Editor Command

Arguments: machine-name
Key sequence: None

The command Remote Shell prompts for a machine name and then starts a shell which tries to login to that computer using rsh.

Note: Remote Shell does not work on Microsoft Windows.

CD Editor Command

Arguments: directory
Key sequence: None
Mode: Shell

Changes the directory associated with the current buffer to directory. The current directory is offered as a default.

shell-cd-regexp Editor Variable

Default value: "cd"
Mode: Shell

A regular expression that matches the shell command to change the current working directory.

shell-pushd-regexp Editor Variable

Default value: "pushd"
Mode: Shell

A regular expression that matches the shell command to push the current working directory onto the directory stack.

shell-popd-regexp Editor Variable

Default value: "popd"
Mode: Shell

A regular expression that matches the shell command to pop the current working directory from the directory stack.

prompt-regexp-string Editor Variable

Default value: "^[^#$%>
]*[#$%>] *"
Mode: Shell

The regexp used to find the prompt in a Shell window. This variable is also used in the Listener.

Interrupt Shell Subjob Editor Command

Arguments: None
Key sequence: Ctrl+C Ctrl+C
Mode: Shell

Sends an interrupt signal to the subjob currently being run by the shell. This is equivalent to issuing the shell command Ctrl+C.

Note: this command does not work on Microsoft Windows.

Stop Shell Subjob Editor Command

Arguments: None
Key sequence: Ctrl+C Ctrl+Z
Mode: Shell

Sends a stop signal to the subjob currently being run by the shell. This is equivalent to issuing the shell command Ctrl+Z.

Note: this command does not work on Microsoft Windows.

Shell Send Eof Editor Command

Arguments: None
Key sequence: Ctrl+C Ctrl+D
Mode: Shell

Sends an end-of-file character (Ctrl+D) to the shell, causing either the shell or its current subjob to finish.

Note: this command does not work on Microsoft Windows.

Kill Shell Subjob Editor Command

Arguments: None
Key sequence: None

The command Kill Shell Subjob tries to kill the subjob in the shell.

At the time of writing, on Solaris it actually sends a SIGKILL signal. On other Unix platforms it sends the VQUIT characters. On Microsoft Windows it calls TerminateProcess.

Terminate Shell Subjob Editor Command

Arguments: None
Key sequence: None

The command Terminate Shell Subjob tries to kill the subjob in the shell.

At the time of writing, on Solaris it actually sends a SIGTERM signal. On other Unix platforms it sends the VQUIT characters. On Microsoft Windows it calls TerminateProcess.


Editor User Guide (Unix version) - 01 Dec 2021 19:35:18