Wm/sh invokes the shell sh(1) with the arguments -n sh-args; wm/mash invokes mash(1) with the arguments mash-args. Wm/sh accepts the following additional options, which are not passed through to sh:
Wm/sh and wm/mash both provide their own versions of /dev/cons and /dev/consctl files in the namespace of the invoked shell (see cons(3) for the originals) and attach the standard input of the invoked shell to the virtualised /dev/cons file. Output from the shell, or of any commands run by the shell, is displayed in a scrollable text window, appearing at the output position, which is at the end of any previously output text, before any as-yet-unread user input text.
Any text displayed on the console can be edited. Typed text is always inserted at the position of the input cursor. The input cursor can be moved to any point in the text by clicking mouse button-1 at the desired position. Selections can be made by dragging the mouse with button-1 held down. Typing into a selection copies its text to the Snarf buffer, the selected text is deleted and the typed character inserted.
Text typed beyond the output point will be made available to commands reading from /dev/cons. Normally this text is made available when newline is typed, but typing ESC turns on hold mode (the text turns blue), deferring the availability of the text until ESC is typed again, turning hold mode off. This allows simple multi-line editing of the standard input to a command.
Writing rawon to /dev/consctl changes the above behaviour, making each character typed beyond the output point available to commands as soon as it is typed; the character is not automatically echoed. Writing rawoff to /dev/consctl reverses this behaviour.
In addition to dragging out selections, they can be made by double clicking mouse button-1. Double clicking over a word selects the whole word. Double clicking next to a brace or bracket selects the text between it and its matching brace or bracket. If there is no match then no selection is made.
Clicking mouse button-2 displays a pop-up menu of editing commands:
Mouse chording is implemented as in acme(1). Dragging a selection with button-1 held down and then also clicking button-2 cuts the selected text into the Snarf buffer. Clicking button-3 instead of button-2 replaces the selected text with the contents of the Snarf buffer.
Clicking mouse button-3 plumbs the word or selection under the click point. See plumber(8) for more information on plumbing.
Wm/sh also serves the file /chan/shctl. The following commands may be written to this file:
Arguments to commands sent to /chan/shctl follow sh(1) quoting rules (the same as implemented by quoted and unquoted in string(2)). A process reading from /chan/shctl will block until an action button is activated, whereupon it will yield the sendtext associated with the button.
fn cd {builtin cd $*; echo cwd `{pwd} >/chan/shctl}
Note that this will not work in all cases, as it is possible to change the current directory without using the cd command.
Create a button to automate a mount command (note the newline in the argument string):
echo ${quote button mount 'mount kremvax /n/remote '} > /chan/shctl
Create a new wm/sh window with the above button already created:
wm/sh -ic { echo ${quote button mount 'mount kremvax /n/remote '} > /chan/shctl }
WM-SH(1 ) | Rev: Tue Mar 31 02:42:38 GMT 2015 |