.autoparagraph
.flag bold
.enable bold
.title ^*V\\sh ^User ^Manual\*
.chapter ^*V\\sh ^User ^Manual\*
.center
by
.blank
.center
Camillo Bongiovanni
.center
Via Massena, 12
.center
10100 Torino (ITALY)
.center
ph._# 011/542173
.blank 3
.header level 1 ^*\\vsh - a shell (command interpreter) for ^^VAX/VMS\*
.header level 2 Synopsis
 vsh
.header level 2 Description
 ^*Vsh\* is a command language interpreter; it repeatedly performs the
following actions: a line of command input is read and broken into ^*words\*.
This sequence of words is placed on the command history and then parsed;
finally each command in the current line is executed.
The shell splits input lines into words at blanks and tabs with the following
exception: the characters '|' '_\' '<' '>' form separate words; these parser
metacharacters act as separators in order to identify special actions to be
taken by the shell.
.header level 3 Commands
 A simple command is a sequence of words, the first of which specifies the
command to be executed. A simple command or a sequence of simple
commands separated by '|' characters forms a ^*pipeline\*. The output of
each command in a pipeline is connected to the input of the next. Sequences of
pipelines may be separated by '_\' and are then executed sequentially. We
now describe the various transformations the shell performs on the input
in the order in which they occur.
.header level 3 History substitutions
 History substitutions can be used to reintroduce sequences of words from
previous commands, possibly performing modifications on these words.
History substitutions begin with the character '!' and may begin anywhere
in the input stream if a history substitution is not already in progress.
History substitutions also occur when an input line begins with '_^'; this
special abbreviation will be described later.
 Any input line which contains history substitution is echoed on the terminal
before it is executed, in the form in which it would have been typed without
history substitution.
 Commands input from the terminal which consist of one or more words are
saved on the history list; commands are numbered sequentially from 1.
For definiteness, consider the following output from the ^*history -5\*
command:
.literal

      9 show users
     10 edit sample.for
     11 type sample.for
     12 difference sample.for
     13 history -5

.end literal
 The commands are shown with their event number (this number is part of the
user prompt).
With the current event 14 we can refer to previous events by event number
'!11', relatively as in '!-3' (referring to the same event), by a prefix of
a command word as in '!d' for event 12 or '!sho' for event 9.
These forms, without further modification, simply reintroduce the words of
the specified events; as a special case '!!' refers to the previous command.
 To select words from an event we can follow the event specification by a
':' and a designator for the desired words.
The words of an input line are numbered from 0, the first (usually command)
word being 0, the second (first argument) being 1, etc.
The basic word designators are:
.literal

      0   first (command) word
      n   n-th argument
      ^   first argument
      $   last argument
      *   the argument list, that is the whole line except word 0

.end literal
 The ':' separating the event specification from the word designator can
be omitted if the argument selector is '_^', '$' or '_*'.
After the optional word designator can be placed a modifier, preceded by a ':'.
 The following modifiers are actually defined:
.literal

      s/old/new/  substitute first occurrence of 'old' with 'new'
      l/old/new/  substitute last occurrence of 'old' with 'new'
      g/old/new/  substitute all occurrences of 'old' with 'new'
      p           print the new command but do not execute it

.end literal
 An history reference may be given without an event specification, e.g. '!$'.
In this case the reference is to the previous command.
 A special abbreviation of a history reference occurs when the first character
of an input line is a '_^'; this is equivalent to '!!:s_^' providing a convenient
shorthand for substitutions on the text of the previous line.
Thus '_^lb_^lib_^' fixes the spelling of 'lib' in the previous command.
.header level 3 Input/output
 The standard input and standard output of a command may be redirected with
the following syntax:
.list
.le;_< name
.left margin +5
open file ^*name\* as the standard input.
.left margin -5
.le;_> name
.left margin +5
the file ^*name\* is used as standard output.
If the file does not exist then it is created; if the file exists a new
version is created.
.end list
.header level 2 Known bugs
.list
.le
More than one ':' modifier should be allowed on history substitution.
.le
Pipelines are implemented via subprocesses and local mailboxes; this
mechanism is not completely error free.
As an example, consider the command
 directory | more
.blank
This command should print the directory content a screenful at a time; if you
issue the 'q' command to 'more', then you will find a subprocess (waiting
for completion) attached to the local mailbox ^^MBA0\\.
To fix the problem simply issue the command
 copy ^^MBA0\\ nl:
.blank
that will flush the mailbox (and kill the subprocess).
.le
^Vsh defines logical names ^^SYS$INPUT\\, and ^^SYS$OUTPUT\\ as
^^SYS$COMMAND\\; this traps the 'spawn' command (obscure bug!).
.end list
.page
.header level 1 ^*\\grep - search a file for a pattern^^\*
.header level 2 Synopsis
 grep [-v][-b][-c][-n][-l][-i] expression [file] ...
.header level 2 Description
 ^*Grep\* searches the input files (standard input default) for lines matching
the regular expression. Normally, each line found is copied to the standard
output. If the -v flag is used, all the lines except those matching are printed.
If the -c flag is used, only a count of matching lines is printed.
If the -l flag is used, only names of files which contain matching lines are
printed.
If the -i flag is used, then case of letters is ignored in comparisons.
If the -n flag is used, each line is preceded by its relative line number in
the file.
If the -b flag is used, each line is preceded by the block number on which
it was found (this can be useful sometime).
 In all cases the file name is shown if there is more than one input file.
.header level 2 Known bugs
.list
.le
Lines are limited to 255 characters; longer lines are truncated
.le
Case recognition is painful under ^^VAX/VMS\\
.end list
.page
.header level 1 ^*\\more - file perusal filter for crt viewing^^\*
.header level 2 Synopsis
 more [-l] [-*n] [+^*linenumber\*] [name ...]
.header level 2 Description
 ^*More\* is a filter which allows examination of a continuous text one
screenful at a time on a soft-copy terminal.
It normally pauses after each screenful, printing --More-- at the bottom
of the screen.
If the user then types a carriage return, one more line of text is displayed.
If the user hits a space, another screenful is displayed.
Other possibilities are enumerated later.
 The command line options are:
.list
.le;-n
.left margin +5
an integer which is the size (in lines) of the window which ^*more\* will
use instead of the default (24)
.lm -5
.le;-l
.lm +5
do not treat _^L (form feed) specially.
If this option is not given, ^*more\* will pause after any line that contains
a _^L, as if the end of a screenful had been reached.
Also, if a file begins with a form feed, the screen will be cleared before
the file is printed.
.lm -5
.le;+^*linenumber\*
.lm +5
start up at ^*linenumber\*
.lm -5
.end list
 Other sequences which may be typed when ^*more\* pauses, and their effects,
are as follows (*i is an optional integer argument, defaulting to 1):
.list
.le;*i_<space_>
.lm +5
display *i more lines (or another screenful if no argument is given)
.lm -5
.le;_^D or d
.lm +5
display 11 more lines (a half screen, or 'scroll'). If *i is given, then the scroll size is
set to *i
.lm -5
.le;*iz
.lm +5
same as typing a space except that *i, if present, becomes the new window size
.lm -5
.le;*is
.lm +5
skip *i lines and print a screenful of lines
.lm -5
.le;*if
.lm +5
skip *i screenfuls and print a screenful of lines
.lm -5
.le;q or Q
.lm +5
exit from ^*more\*
.lm -5
.le;=
.lm +5
display the current line number
.lm -5
.le;h or ?
.lm +5
help command; give a description of all the ^*more\* commands
.lm -5
.le;*i:n
.lm +5
skips to the *i-th next file given in the command line (skips to last file if
*i doesn't make sense)
.lm -5
.le;*i:p
.lm +5
skip to the *i-th previous file given in the command line.
If this command is given in the middle of printing out a file, then ^*more\*
goes back to the beginning of the file.
If *i doesn't make sense, ^*more\* skips back to the first file.
If ^*more\* is not reading from a file, the bell is rung and nothing else
happens
.lm -5
.le;:f
.lm +5
display the current file name and line number
.lm -5
.le;:q or :Q
.lm +5
exit from ^*more\* (same as q or Q)
.lm -5
.le;_. (dot)
.lm +5
repeat the previous command
.lm -5
.end list
 If the standard output is not a terminal (there is output redirection),
then ^*more\* acts just like ^*type\*, except that a header is printed
before each file (if there is more than one).
