Search                        Top                                  Index
HELP IMCSH                                        Tom Khabaza April 1984
                                               updated A.Sloman Aug 1986

IMCSH  and <ENTER> imcsh

If your computer provides the 'c-shell' (usually invoked by 'csh' or
'/bin/csh' - normally available only on Berkeley Unix systems) then
IMCSH allows you to execute c-shell commands using the 'immediate mode'
mechanism in VED. This permits commands to a process to be given in a
VED file, with all output being spliced back into the same file.

IMCSH is a POP-11 macro and a VED <ENTER> command. Using imcsh in any of
these ways will put you in VED in a file called "cshfile" whose
associated compiler is csh_compile, and switch on immediate mode for
that file.

If you invoke it from VED, an optional argument can be given

    <ENTER> imcsh <filename>

to specify the name of the file to be used.

Because IMCSH sets up the file to use 'immediate mode', whenever you
press <RETURN> with the cursor in its window, the current line is sent
to the c-shell as a command.  Any standard output from the c-shell
process will appear in the VED buffer.  This is often useful for
executing commands whose output is long, but not worth saving in a
dedicated file, e.g. 'ls -l' might cause something like the following to
be spliced into the file:

    % ls -l

    drwxrwxrwx  2 fred         1024 Apr 27 09:20 bak
    -rw-rw-r--  1 fred           32 Apr 28 00:01 foo
    -rw-rw-rw-  1 fred          213 Apr 28 01:52 index
    -rw-rw-r--  1 fred          459 Apr 27 00:50 utils.p
    -rw-rw-r--  1 fred        18823 Apr 28 04:09 vedcomms.p

The ampersand '&' can be put at the end of the command line as usual to
spawn a background process. In that case you can continue editing
another file and come back to the imcsh file later, then press <RETURN>
(ON A BLANK LINE) to see the output.

The c-shell prompt will be inserted at the beginning of the current line
whenever the c-shell process is waiting for input. This prompt is not
sent with the rest of the line when you press <RETURN>.

WARNING: if your .cshrc file defines the prompt to change after every
command (e.g. if your prompt string includes "\!" to indicate the
command number) then the program cannot cope, as it uses the prompt
sent back from the csh process to tell when it is ready for input.

So the program uses a fixed, though user-assignable, font string as
described in HELP * CSH_COMPILE

Each line sent is copied to the end of the file, if it was not there
already, and any output will follow it there. This enables the file to
retain a 'log' of interactions with csh, and also implies that any
previous command can easily be repeated, possibly after editing. This is
often more convenient than the CSH 'history' mechanism. 'History'
commands (e.g. '!5') may be given as usual, but will have to be preceded
by a space as '!' at the beginning of the line will cause the rest of
the line to be given to a new sub-shell.

See HELP * IMSH for a similar facility for running bourne shell (/bin/sh)
processes in a VED window.

IMCSH (like IMSH) cannot be used with an interactive program that
expects input from the terminal. For instance, it cannot be used with
mail. If an attempt is used to invoke such a program, imcsh will hang
up, and will have to be interrupted by typing the QUIT interrupt
character ONCE. This will invoke 'setpop' after which you will be able
to return to VED. (If QUIT is typed twice, quickly, the whole POPLOG
session will be aborted.)


Multi-line commands are only allowed if they produce the continuation
prompt for the extra lines, so although
    foreach i (foo baz)
        ls $i
is ok,
    ls \
is NOT.

IMCSH (and VED_CSHFILE) are not suitable for use with interactive

--- C.unix/help/imcsh
--- Copyright University of Sussex 1990. All rights reserved. ----------