home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
misc
/
volume32
/
shlm
/
part01
/
shm.doc
< prev
Wrap
Text File
|
1992-09-20
|
6KB
|
175 lines
SHM(1) Unix Programmer's Manual SHM(1)
NAME
shm - shell layer manager
SYNOPSYS
shm [ -c | +c ] [ program ... ]
DESCRIPTION
shm is a clone of shl which allows a user to interact with
more than one shell from a single terminal. The user controls
these shells, known as layers, using the key strokes
described below. shm automatically sets saves the screen
contents when it is started from the console device. The -c
flag forces console saving, the +c flag disables it.
shm differs from shl in five important respects.
1) shm allows quicker switching and layer creation, using
simple key sequence. Each sequence starts with your
swtch(switch) character, which is usually ^Z, but may
be redefined using stty.
2) when run from the console, shm saves the screen
contents of each layer between switches
3) shm allows the specification of one or more programs
to be placed in separate layers upon startup.
4) shm starts up in a layer, not at an shm prompt.
In fact, there is no shm prompt, and all commands
conclude by re-activating another layer.
5) shm clears the screen when switching layers, and
automatically exits when all layers have exited.
The current layer is the layer that can receive input from
the keyboard. Other layers attempting to read from the
keyboard are blocked. Output from dormant layers causes
the layer to go to sleep, waiting to become active before
resuming. This default behavior can be changed by using
stty -loblk in that layer or using an shm command described
below.
COMMANDS
All shm commands start with your switch character, which we
will assume is ^Z. The next character may be:
C, Z create a new layer
D delete the current layer
S show existing layers
^Z, N, ^N, L, ^L
Switch, or Return next layer
P, ^P, Backspace previous layer
1, 2,..max_layers create/activate layer number
R, Space resume current layer
B turn off output blocking for that layer
T toggle between layers
H, ? help
Q, ^D close all layers and quit shm
Upper/lower case is insignificant, and ^ designates a control
character. There are many alternatives for several commands
to suit individual tastes.
Some of my very popular key sequences are:
^Z, Z create new layer
^Z, ^Z go to next layer
^Z, ^L, ^L go to next layer and redisplay
application screen
^Z, Return,
Return go to next layer and display prompt
^Z, 1 go to layer 1
shm will automatically terminate when all its layers have been
exited, so if you have three shells active, ^D, ^D, ^D will cause
shm to exit, and return you to your normal single-layer shell.
ENVIRONMENT
shm reads several environment variables.
ISHELL Users default interactive shell
SHELL Shell to invoke if ISHELL is not set
TERM Used to get string that clears the screen
shm sets one or two variables.
LAYER Equals the layer number
PS1 Set only if shm is compiled with SHELL_STARTUP
undefined, this equals $LAYER surrounded by
parentheses
NOTES
I have found that using 'ps' from within a shell layer displays
a header but nothing else. I suppose 'ps' get confused by the
sxt devices. Try using this as a substitute for 'ps'. It should
be aliased to 'ps' or placed in your path before the real 'ps'.
:
# ps for shm
# usage ps [-z & usual ps args]
MAXPCHAN=8
if [ $# -eq 0 ]
then SXT_NUM="`expr \`tty\` : '/dev/sxt\(.*\)'`"
exec /bin/ps -t "sxt/$SXT_NUM"
elif [ "`expr \"$1\" : '-.*z.*$'`" -ne 0 ]
then
[ "$1" != "-z" ] &&
ZOPT="`echo $1 | sed 's/\(-.*\)z\(.*\)$/\1\2/'`"
shift
SXT_NUM="`expr \`tty\` : '/dev/sxt\(.*\)'`"
SXT_TERMS="`echo $SXT_NUM $MAXPCHAN | \
awk '{ for (i=0; i<$2; i++) \
printf \"sxt/%03d,\",\
int($1/$2)*$2+i; }'`"
exec /bin/ps $ZOPT $@ -t $SXT_TERMS
else exec /bin/ps $*
fi
It is also difficult to find out the name of the tty you logged
in on when you are in a shell layer. 'tty' reports the layer
device, i.e. /dev/sxt001 not /dev/console. One way to get this
information is to add a comment to the end of each (uu)getty
line in /etc/inittab, like this:
co:12345:respawn:/etc/getty console console #console
I00:23:respawn:/etc/uugetty -rt180 tty00 2400 #tty00
I01:23:respawn:/etc/getty tty01 19200 #tty01
You can then use a script like this one to find the login tty:
:
# login tty for shm
TTY_DEV="`expr \`tty\` : '/dev/\(.*\)'`"
set `/bin/who -u | grep "$TTY_DEV"` ; echo $8
The login tty is often needed in profiles to test for terminal
types.
When placing programs in certain layers upon invocation of
shm, the programs do not actually start running until the
layer is activated. Use the null string('') to start up a
shell in a certain layer, i.e. shm and shm '' do the same
thing, and shm '' '' starts two shells.
I have found that when running shm from the console, if a
warning message is sent to the console from the kernel, the
message is lost or the /dev/console becomes the active tty,
causing shm to hang.
AUTHOR
Bruce Momjian, root%candle.uucp@bts.com Sept 13, 1992
shm version 1.1