Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ csh(1) — DG/UX 4.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought



                                                                   csh(1)



        _________________________________________________________________
        csh                                                       Command
        a shell (command interpreter) with C-like syntax for DG/UX
        _________________________________________________________________


        SYNTAX

        csh [ -cefinstvVxX ] [ arg ...  ]


        DESCRIPTION

        Csh is an implementation of a command language interpreter
        incorporating a history mechanism (see History Substitutions),
        job control facilities (see Jobs) , a C-like syntax, and
        editread.  Editread is an optional interface used for editing
        command lines entered from the shell.  It also provides a history
        facility that saves previously typed commands (see Using the
        DG/UX System for more information).  To use its job control
        facilities, you must use the new tty driver (see newtty(7) and
        tty(7) for DG/UX).  This new tty driver lets you generate
        interrupt characters from the keyboard to tell jobs to stop.
        Stty(1) gives details on setting options in the new tty driver.

        An instance of csh begins by executing commands from the file
        /etc/login.csh, then the file .cshrc in the home directory of the
        invoker.  If the shell is being invoked as a result of a user
        logging on, then it also executes commands from the file .login
        there.  CRT users usually put an stty command in their .login
        files. For a 605x terminal, the command

             stty echoe -icrnl -onlcr erase ^? intr ^c kill ^u obs ^y
        will set things up appropriately: the erase character is set to
        the DEL key, control-c interrupts command or program execution,
        and control-u kills the current input (the obs setting is
        necessary and unique to 605x terminals).

        The shell will usually begin reading commands from the terminal,
        prompting with % . Processing arguments and using the shell to
        process files containing command scripts are described later.

        The shell then repeats these steps:  It reads a line of command
        input and breaks it into words. The shell places this sequence of
        words on the command history list and parses it.  Finally, it
        executes each command in the current line.

        When a login shell terminates, it executes commands from the file
        .logout in the user's home directory.





        DG/UX 4.00                                                 Page 1
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        Lexical structure

        The shell splits input lines into words at blanks and tabs with
        the following exceptions.  The characters &, |, ;, <, >, (, and )
        form separate words.  If doubled in &&, ||, <<, or >>, these
        pairs form single words.  To make these parser metacharacters
        part of other words, or to prevent their special meaning, precede
        them with \.  A newline preceded by a \ is equivalent to a blank.

        In addition, strings enclosed in matched pairs of quotations ('',
        ``,  or "") form parts of a word; metacharacters in these
        strings, including blanks and tabs, do not form separate words.
        The rules for these quotations are described below.  Within
        enquoting characters, a new-line preceded by a \ gives a true
        new-line character.

        When the shell's input is not a terminal, the character #
        introduces a comment that continues to the end of the input line.
        It does not have this special meaning when you precede it with \
        and in quotations using `, ', and ".

        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 pipe 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.  To
        execute a sequence of pipelines without immediately waiting for
        it to terminate, follow it with an &.

        Any of the above may be placed in parentheses to form a simple
        command (which may be a component of a pipeline, etc.) You can
        also separate pipelines with || or && indicating, as in the C
        language, that the second is to be executed only if the first
        fails or succeeds (see Expressions ).

        Jobs

        The shell associates a job with each pipeline.  It keeps a table
        of current jobs, printed by the jobs command, and assigns them
        small integer numbers.  When a job is started asynchronously with
        &, the shell prints a line that looks like:

             [1] 1234

        indicating that the job started asynchronously was job number 1,
        which had one (top-level) process, and whose process id was 1234.

        If you are running a job and want to do something else, type ^Z



        DG/UX 4.00                                                 Page 2
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        (control-Z), which sends a STOP signal to the current job.  The
        shell should indicate that the job has been stopped, and print
        another prompt.  You can then manipulate the state of this job,
        putting it in the background with the bg command, or run some
        other commands and then eventually bring the job back into the
        foreground with the foreground command fg.  A ^Z takes effect
        immediately and is like an interrupt:  pending output and unread
        input are discarded when it is typed.  The special key ^Y does
        not generate a STOP signal until a program tries to read(2) it.
        This can usefully be typed ahead when you have prepared some
        commands for a job that you wish to stop after it has read them.

        A job running in the background will stop if it tries to read
        from the terminal.  Background jobs are normally allowed to
        produce output, but this can be disabled by giving the command
        stty tostop. If you set this tty option, then background jobs
        will stop when they try to produce output like they do when they
        try to read input.

        There are several ways to refer to jobs in the shell.  The
        character % introduces a job name.  If you wish to refer to job
        number 1, you can name it as %1.  Just naming a job brings it to
        the foreground; thus %1 is a synonym for fg %1, bringing job 1
        back into the foreground.  Similarly, saying %1 & resumes job 1
        in the background.  Jobs can also be named by prefixes of the
        string typed in to start them, if these prefixes are unambiguous.
        Thus, %ex would normally restart a suspended ex(1) job, if there
        were only one suspended job whose name began with the string
        "ex."  You can also specify %?string, for a a job whose text
        contains string, if there is only one such job.

        The shell maintains a notion of the current and previous jobs.
        In output pertaining to jobs, the current job is marked with a +
        and the previous job with a -.  The abbreviation %+ refers to the
        current job and %- refers to the previous job.  To follow the
        syntax of the history mechanism (described below), %% is also a
        synonym for the current job.

        Status reporting

        This shell learns immediately whenever a process changes state.
        It normally informs you whenever a job becomes blocked so that no
        further progress is possible, but only just before it prints a
        prompt.  This is to avoid disturbing your work.  However, if you
        set the shell variable notify, the shell will notify you
        immediately of changes of status in background jobs.  There is
        also a shell command notify that marks a single process so that
        its status changes will be immediately reported.  By default,
        notify marks the current process; simply say notify after
        starting a background job to mark it.




        DG/UX 4.00                                                 Page 3
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        When you try to leave the shell while jobs are stopped, you will
        be warned that you have stopped jobs.  The jobs command lets you
        see what they are.  If you do this or immediately try to exit
        again, the shell will not warn you a second time, and the
        suspended jobs will be terminated.

        Substitutions

        We now describe the transformations that the shell performs on
        the input, in the order in which they occur.

        History substitutions

        History substitutions use words from previous command input as
        portions of new commands.  This makes it easy to repeat commands,
        repeat arguments of a previous command in the current command, or
        fix spelling mistakes in the previous command.  History
        substitutions begin with the character ! and may begin anywhere
        in the input stream, as long as they do not nest.  This ! may be
        preceded by a \ to prevent its special meaning; a ! is passed
        unchanged when it is followed by a blank, tab, new-line, = or (.
        (History substitutions also occur when an input line begins with
        ↑.  This special abbreviation is described later.) Any input line
        that contains history substitution is echoed on the terminal
        before it is executed as it could have been typed without history
        substitution.

        Commands input from the terminal that consist of one or more
        words are saved on the history list.  The history substitutions
        reintroduce sequences of words from these saved commands into the
        input stream.  The size of the input stream is controlled by the
        history variable; the previous command is always retained,
        regardless of its value.  Commands are numbered sequentially from
        1.

        Consider the following output from the history command:

              9  write michael
             10  ex write.c
             11  cat oldwrite.c
             12  diff *write.c

        The commands are shown with their event numbers.  You do not
        usually need to use event numbers, but the current event number
        can be made part of the prompt if you place an ! in the prompt
        string.

        With the current event 13, you can refer to previous events by
        event number !11, relatively as in !-2 (referring to the same
        event), by a prefix of a command word as in !d for event 12 or
        !wri for event 9, or by a string contained in a word in the



        DG/UX 4.00                                                 Page 4
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        command as in !?mic? also referring to event 9.  These forms,
        without further modification, simply reintroduce the words of the
        specified events, each separated by a blank.  As a special case
        !! refers to the previous command; thus !!  alone is essentially
        a redo.

        To select words from an event you can follow the event
        specification by a : and a designator for the desired words.  The
        words of a input line are numbered from 0, the first (usually
        command) word being 0, the second word (first argument) being 1,
        etc.  The basic word designators are:

             0    first (command) word
             n    nth argument
             ↑    first argument,  i.e. 1
             $    last argument
             %    word matched by (immediately preceding) ?s? search
             x-y  range of words
             -y   abbreviates 0-y
             *    abbreviates ↑-$, or nothing if only 1 word in event
             x*   abbreviates x-$
             x-   like x* but omitting word $

        You can omit the : separating the event specification from the
        word designator if the argument selector begins with a ↑, $, * -
        or %.  A sequence of modifiers can follow the optional word
        designator.  Precede each with a :.  The following modifiers are
        defined:

             h      Remove a trailing pathname component, leaving the head.
             r      Remove a trailing .xxx component, leaving the root name.
             e      Remove all but the extension .xxx.
             s/l/r/ Substitute l with r
             t      Remove all leading pathname components, leaving the tail.
             &      Repeat the previous substitution.
             g      Apply the change globally, prefixing the above, e.g. g&.
             p      Print the new command but do not execute it.
             q      Quote the substituted words (no further substitutions).
             x      Like q, but break into words at blanks, tabs and new-lines.

        Unless preceded by a "g," the modification is applied only to the
        first modifiable word.  With substitutions, it is an error for no
        word to be applicable.

        The left-hand side of substitutions are not regular expressions
        in the sense of the editors, but rather strings.  You can use any
        character as the delimiter in place of /; a \ quotes the
        delimiter in the l and r strings.  The character & in the right-
        hand side is replaced by the text from the left.  A \ quotes &
        also.  A null l uses the previous string from a l or from a
        contextual scan string s in !?s?.  The trailing delimiter in the



        DG/UX 4.00                                                 Page 5
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        substitution may be omitted if a new-line follows immediately; so
        may the trailing ? in a contextual scan.

        You can give a history reference without an event specification
        with !$.  The reference is to the previous command unless a
        previous history reference occurred on the same line.  In that
        case, this form repeats the previous reference.  Thus, !?foo?↑ !$
        gives the first and last arguments from the command matching
        ?foo?.

        A special abbreviation of a history reference occurs when the
        first non-blank 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.  Finally, you
        can surround a history substitution with { and } to insulate it
        from the characters that follow.  Thus, after "ls -ld ~paul," you
        might do "!{l}a' to do "ls -ld ~paula," while "!la" would look
        for a command starting "la".

        Quoting

        The following characters have a special meaning and terminate a
        word unless quoted:

             ;  &  (  )  |  ^  <  >  new-line  space  tab

        You can make a character stand for itself by preceding it with a
        \.  This is called quoting.  The pair \new-line is ignored.

        Quotations with ' and "

        Enguoting strings with ' and " can prevent all or some of the
        remaining substitutions.  Strings enclosed in ' are not
        interpreted further.  Strings enclosed in " will still expand
        variables and commands, as described below.

        In both cases, the resulting text becomes (all or part of) a
        single word; only in one special case (see "Command Substitition"
        below) does a " quoted string yield parts of more than one word;
        ' quoted strings never do.

        Alias substitution

        The shell maintains a list of aliases that you can establish,
        display and modify with the alias and unalias commands.  After a
        command line is scanned, it is parsed into distinct commands and
        the first word of each command, left-to-right, is checked to see
        if it has an alias.  If it does, then the alias for that command
        is reread with the history mechanism available as though that
        command were the previous input line.  The resulting words



        DG/UX 4.00                                                 Page 6
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        replace the command and argument list.  If no reference is made
        to the history list, then the argument list is left unchanged.

        Thus, if the alias for "ls" is "ls -l," the command "ls /usr"
        would map to "ls -l /usr," and the argument list would stay the
        same.  Similarly, if the alias for "lookup" was "grep !↑
        /etc/passwd", then "lookup bill" would map to "grep bill
        /etc/passwd."

        If an alias is found, the word transformation of the input text
        is performed and the aliasing process begins again on the
        reformed input line.  Looping is prevented if the first word of
        the new text is the same as the old by flagging it to prevent
        further aliasing.  Other loops are detected and cause an error.

        Aliases can introduce parser metasyntax.  Thus, we can "alias
        print pr \| lp" to make a command print which pr's its arguments
        to the line printer.

        Variable substitution

        The shell maintains a set of variables, each of which has as
        value a list of zero or more words.  Some of these variables are
        set by the shell or referred to by it.  For instance, the argv
        variable is an image of the shells argument list, and words of
        this variables value are referred to in special ways.

        The set and unset commands display and change the values of
        variables.  Some of the variables referred to by the shell are
        toggles; the shell does not care what their value is, only
        whether they are set.  For instance, the verbose variable is a
        toggle that echoes command input.  The setting of this variable
        results from the -v command line option.

        Other operations treat variables numerically.  The @ command
        permits numeric calculations to be performed and the result
        assigned to a variable.  Variable values are, however, always
        represented as (zero or more) strings.  In numeric operations,
        the null string is considered to be zero, and the second and
        subsequent words of multiword values are ignored.

        After the input line is aliased and parsed, and before each
        command is executed, variable substitution is performed keyed by
        $ characters.  This expansion can be prevented by preceding the $
        with a \ except within double quotes ("), where it always occurs,
        and within right quotes ('), where it never occurs.  Strings
        quoted by ` are interpreted later (see "Command substitution,"
        below) so $ substitution does not occur there until later, if at
        all.  A $ is passed unchanged if followed by a blank, tab, or
        end-of-line.




        DG/UX 4.00                                                 Page 7
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        Input/output redirections are recognized before variable
        expansion, and are variable expanded separately.  Otherwise, the
        command name and entire argument list are expanded together.  It
        is thus possible for the first (command) word to this point to
        generate more than one word, the first of which becomes the
        command name, and the rest of which become arguments.

        Unless enclosed in double quotes or given the :q modifier, the
        results of variable substitution may eventually be command and
        filename substituted.  Within double quotes, a variable whose
        value consists of multiple words expands to a single word that
        itself is made up of the multiple words separated by blanks.
        When the :q modifier is applied to a substitution, the variable
        will expand to multiple words with each word separated by a blank
        and enquoted. Both methods prevent later command or filename
        substitution.

        The following metasequences introduce variable values into the
        shell input.  Except as noted, it is an error to reference an
        unset variable.

        $name
        ${name}
             Replaced by the words of the value of variable name, each
             separated by a blank.  Braces insulate name from following
             characters that would otherwise be part of it.  Shell
             variables have names consisting of up to 20 letters and
             digits starting with a letter.  The underscore character is
             considered a letter.
             If name is not a shell variable, but is set in the
             environment, then that value is returned (but : modifiers
             and the other forms given below are not available in this
             case).

        $name[selector]
        ${name[selector]}
             May be used to select only some of the words from the value
             of name. The selector is subjected to $ substitution and may
             consist of a single number or two numbers separated by a -.
             The first word of a variables value is numbered 1.  If the
             first number of a range is omitted it defaults to 1.  If the
             last member of a range is omitted it defaults to $#name.
             The selector * selects all words.  It is not an error for a
             range to be empty if the second argument is omitted or in
             range.

        $#name
        ${#name}
             Gives the number of words in the variable.  This is useful
             for later use in a [selector].




        DG/UX 4.00                                                 Page 8
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        $0
             Substitutes the name of the file from which command input is
             being read.  An error occurs if the name is not known.

        $number
        ${number}
             Equivalent to $argv[number].

        $*
             Equivalent to $argv[*].

        The modifiers :h, :t, :r, :q and :x may be applied to the
        substitutions above as may :gh, :gt and :gr.  If braces { }
        appear in the command form then the modifiers must appear within
        the braces.  The current implementation allows only one :
        modifier on each $ expansion.

        The following substitutions may not be modified with : modifiers.

        $?name
        ${?name}
             Substitutes the string 1 if name is set, 0 if it is not.

        $?0
             Substitutes 1 if the current input filename is known, 0 if
             it is not.

        $$
             Substitutes the (decimal) process number of the (parent)
             shell.

        $<
             Substitutes a line from the standard input, with no further
             interpretation.  It can be used to read from the keyboard in
             a shell script.

        Command and filename substitution

        The remaining substitutions, command and filename substitution,
        are applied selectively to the arguments of built-in commands.
        This means that unevaluated portions of expressions are not
        subjected to these expansions.  For commands which are not
        internal to the shell, the command name is substituted separately
        from the argument list.  This occurs very late, after input-
        output redirection is performed, and in a child of the main
        shell.

        Command substitution

        Command substitution is indicated by a command enclosed in
        "backquotes" (`).  The output from such a command is normally



        DG/UX 4.00                                                 Page 9
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        broken into separate words at blanks, tabs and new-lines.  Null
        words are discarded, and this text replaces the original string.
        Within double quotes, only new-lines force new words; blanks and
        tabs are preserved.

        In any case, the single final new-line does not force a new word.
        Note that it is thus possible for a command substitution to yield
        only part of a word, even if the command outputs a complete line.

        Filename substitution

        If a word contains any of the characters *, ?, [ or { or begins
        with the character ~, then that word is a candidate for filename
        substitution.  This word is then regarded as a pattern, and
        replaced with an alphabetically sorted list of filenames that
        match the pattern.  In a list of words specifying filename
        substitution, it is an error for no pattern to match an existing
        filename, but not each pattern must match.  Only the
        metacharacters *, ? and [ imply pattern matching; the characters
        ~ and { are more akin to abbreviations.

        In matching filenames, the character . at the beginning of a
        filename or immediately following a /, as well as the character /
        must be matched explicitly.  The character * matches any string
        of characters, including the null string.  The character ?
        matches any single character.  The sequence [...] matches any one
        of the characters enclosed.  Within [...], a pair of characters
        separated by - matches any character lexically between the two.

        The character ~ at the beginning of a filename refers to a home
        directory.  Standing alone, i.e. ~, it expands to your home
        directory as reflected in the value of the variable home. When
        followed by a name consisting of letters, digits and - characters
        the shell searches for your name and substitutes your home
        directory.  For example, ~ken might expand to /usr/ken and
        ~ken/chmach to /usr/ken/chmach.  If the character ~ is followed
        by a character other than a letter or / or does not appear at the
        beginning of a word, it is left undisturbed.

        The metanotation a{b,c,d}e is shorthand for abe ace ade.  Left-
        to-right order is preserved, with results of matches being sorted
        separately at a low level to preserve this order.  This construct
        may be nested.  Thus

             ~source/s1/{oldls,ls}.c

        expands to

             /usr/source/s1/oldls.c /usr/source/s1/ls.c

        whether or not these files exist, without any chance of error if



        DG/UX 4.00                                                Page 10
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        the home directory for source is /usr/source.  Similarly

             ../{memo,*box}

        might expand to

             ../memo ../box ../mbox.

        (Note that memo was not sorted with the results of matching
        *box.) As a special case {, } and {} are passed undisturbed.

        Input/output

        You can redirect standard input and standard output of a command
        with the following syntax:

        < name
             Open file name (which is first variable-, command- and
             filename-expanded) as the standard input.

        << word
             Read the shell input up to a line which is identical to
             word. Word is not subjected to variable, filename or command
             substitution, and each input line is compared to word before
             any substitutions are done on this input line.  Unless an
             enquoting \, ", ' or ` appears in word, variable and command
             substitution is performed on the intervening lines, letting
             \ enquote $, \ and `.  Commands that are substituted have
             all blanks, tabs, and new-lines preserved, except for the
             final new-line which is dropped.  The resultant text is
             placed in an anonymous temporary file which is given to the
             command as standard input.

        > name
        >! name
        >& name
        >&! name
             The file name is used as standard output.  If the file does
             not exist then it is created; if the file exists, its is
             truncated, its previous contents being lost.

             If the variable noclobber is set, then the file must not
             exist or be a character-special file (e.g. a terminal or
             /dev/null) or an error results.  This helps prevent
             accidental destruction of files.  In this case the ! forms
             can be used and suppress this check.

             The forms involving & route the diagnostic output into the
             specified file as well as the standard output.  Name is
             expanded in the same way as < input filenames are.




        DG/UX 4.00                                                Page 11
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        >> name
        >>& name
        >>! name
        >>&! name
             Uses file name as standard output like > but places output
             at the end of the file.  If the variable noclobber is set,
             then it is an error for the file not to exist unless one of
             the ! forms is given.  Otherwise similar to >.

        A command receives the environment in which the shell was invoked
        as modified by the input-output parameters and the presence of
        the command in a pipeline.  Thus, unlike some previous shells,
        commands run from a file of shell commands have no access to the
        text of the commands by default; rather they receive the original
        standard input of the shell.  The << mechanism should be used to
        present inline data.  This permits shell command scripts to
        function as components of pipelines and allows the shell to block
        read its input.  Note that the default standard input for a
        command run detached is not modified to be the empty file
        /dev/null; rather the standard input remains as the original
        standard input of the shell.  If this is a terminal and if the
        process attempts to read from the terminal, then the process will
        block and the user will be notified (see Jobs above.)

        Diagnostic output may be directed through a pipe with the
        standard output.  Simply use the form |& rather than just |.

        Expressions

        A number of the built-in commands (to be described subsequently)
        take expressions, in which the operators are similar to those of
        C, with the same precedence.  These expressions appear in the @,
        exit, if, and while commands.  The following operators are
        available:

             ||  &&  |  ↑  &  ==  !=  =~  !~  <=  >=  <  >  <<  >>  +  -
        *  /  %  !  ~  (  )

        Here the precedence increases to the right, == != =~ and !~, <=
        >= < and >, << and >>, + and -, * / and % being, in groups, at
        the same level.  The == != =~ and !~ operators compare their
        arguments as strings; all others operate on numbers.  The
        operators =~ and !~ are like != and == except that the right hand
        side is a pattern (containing, e.g. *s, ?s and instances of
        [...]) against which the left hand operand is matched.  This
        reduces the need for use of the switch statement in shell scripts
        when all that is really needed is pattern matching.

        Strings which begin with 0 are considered octal numbers.  Null or
        missing arguments are considered 0.  The result of all
        expressions are strings, which represent decimal numbers.  It is



        DG/UX 4.00                                                Page 12
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        important to note that no two components of an expression can
        appear in the same word; except when adjacent to components of
        expressions which are syntactically significant to the parser (&
        | < > ( )) they should be surrounded by spaces.

        Also available in expressions as primitive operands are command
        executions enclosed in { and } and file enquiries of the form -l
        name where l is one of:

             r    read access
             w    write access
             x    execute access
             e    existence
             o    ownership
             z    zero size
             f    plain file
             d    directory

        The specified name is command and filename expanded and then
        tested to see if it has the specified relationship to the real
        user.  If the file does not exist or is inaccessible then all
        enquiries return false, i.e. 0.  Command executions succeed,
        returning true, i.e. 1, if the command exits with status 0,
        otherwise they fail, returning false, i.e. 0.  If more detailed
        status information is required then the command should be
        executed outside of an expression and the variable status
        examined.

        Control flow

        The shell contains a number of commands which can be used to
        regulate the flow of control in command files (shell scripts) and
        (in limited but useful ways) from terminal input.  These commands
        all operate by forcing the shell to reread or skip in its input
        and, due to the implementation, restrict the placement of some of
        the commands.

        The foreach, switch, and while statements, as well as the
        if-then-else form of the if statement require that the major
        keywords appear in a single simple command on an input line as
        shown below.

        If the shell's input is not seekable, the shell buffers up input
        whenever a loop is being read and performs seeks in this internal
        buffer to accomplish the rereading implied by the loop.  (To the
        extent that this allows, backward gotos will succeed on non-
        seekable inputs.)







        DG/UX 4.00                                                Page 13
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        Built-in commands

        Built-in commands are executed within the shell.  If a built-in
        command occurs as any component of a pipeline except the last
        then it is executed in a subshell.

        alias
        alias name
        alias name wordlist
             The first form prints all aliases.  The second form prints
             the alias for name.  The final form assigns the specified
             wordlist as the alias of name; wordlist is command and
             filename substituted.  Name is not allowed to be alias or
             unalias.

        alloc
             Shows the amount of dynamic core in use, broken down into
             used and free core, and the address of the last location in
             the heap.  With an argument, alloc shows each used and free
             block on the internal dynamic memory chain indicating its
             address, size, and whether it is used or free.  This is a
             debugging command and may not work in production versions of
             the shell; it requires a modified version of the system
             memory allocator.

        bg
        bg %job ...
             Puts the current or specified jobs into the background,
             continuing them if they were stopped.

        break
             Causes execution to resume after the end of the nearest
             enclosing foreach or while. The remaining commands on the
             current line are executed.  Multi-level breaks are thus
             possible by writing them all on one line.

        breaksw
             Causes a break from a switch, resuming after the endsw.

        case label:
             A label in a switch statement as discussed below.

        cd
        cd name
        chdir
        chdir name
             Change the shell's working directory to directory name. If
             no argument is given, then change to the home directory of
             the user.
             If name is not found as a subdirectory of the current
             directory (and does not begin with /, ./ or ../), then each



        DG/UX 4.00                                                Page 14
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             component of the variable cdpath is checked to see if it has
             a subdirectory name. Finally, if all else fails but name is
             a shell variable whose value begins with /, then this is
             tried to see if it is a directory.

        continue
             Continue executing the nearest enclosing while or foreach.
             The rest of the commands on the current line are executed.

        default:
             Labels the default case in a switch statement.  The default
             should come after all case labels.

        dirs
             Prints the directory stack; the top of the stack is at the
             left, the first directory in the stack is the current
             directory.

        echo wordlist
        echo -n wordlist
             The specified words are written to the shell's standard
             output, separated by spaces, and terminated with a new-line
             unless the -n option is specified.

        else
        end
        endif
        endsw
             See the description of the foreach, if, switch, and while
             statements below.

        eval arg ...
             (As in sh(1).) The arguments are read as input to the shell
             and the resulting command(s) executed.  This is usually used
             to execute commands generated as the result of command or
             variable substitution, since parsing occurs before these
             substitutions.  See tset(1) for an example of using eval.

        exec command
             The specified command is executed in place of the current
             shell.

        exit
        exit(expr)
             The shell exits either with the value of the status variable
             (first form) or with the value of the specified expr (second
             form).

        fg
        fg %job ...
             Brings the current or specified jobs into the foreground,



        DG/UX 4.00                                                Page 15
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             continuing them if they were stopped.

        foreach name (wordlist)
            ...
        end
             The variable name is successively set to each member of
             wordlist and the sequence of commands between this command
             and the matching end are executed.  (Both foreach and end
             must appear alone on separate lines.)

             Use the built-in command continue to continue the loop
             prematurely, and the built-in command break to terminate it
             prematurely.  When this command is read from the terminal,
             the loop is read once, prompting with ? before any
             statements in the loop are executed.  If you make a mistake
             typing in a loop at the terminal you use the delete key to
             correct it.

        glob wordlist
             Like echo but no \ escapes are recognized and words are
             delimited by null characters in the output.  Useful for
             programs which wish to use the shell to filename expand a
             list of words.

        goto word
             The specified word is filename and command expanded to yield
             a string of the form "label." The shell rewinds its input as
             much as possible and searches for a line of the form
             "label":  possibly preceded by blanks or tabs.  Execution
             continues after the specified line.

        hashstat
             Print a statistics line indicating how effective the
             internal hash table has been at locating commands (and
             avoiding execs). An exec is attempted for each component of
             the path where the hash function indicates a possible hit,
             and in each component that does not begin with a /.

        history
        history n
        history -r n
        history -h n
             Display the history event list; if n is given, only the n
             most recent events are printed.  The -r option reverses the
             order of printout to be most recent first rather than oldest
             first.  The -h option prints the history list without
             leading numbers.  This produces files suitable for sourcing
             using the -h option to source.

        if (expr) command
             If the specified expression evaluates true, then the single



        DG/UX 4.00                                                Page 16
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             command with arguments is executed.  Variable substitution
             on command happens early, at the same time it does for the
             rest of the if command.  Command must be a simple command,
             not a pipeline, a command list, or a parenthesized command
             list.  Input/output redirection occurs even if expr is
             false, when the command is not executed (this is a bug).

        if (expr) then
            ...
        else if (expr2) then
            ...
        else
            ...
        endif
             If the specified expr is true, then the commands to the
             first else are executed; if expr2 is true, then the commands
             to the second else are executed, etc.  Any number of else-if
             pairs are possible; only one endif is needed.  The else part
             is likewise optional.  (The words else and endif must appear
             at the beginning of input lines; the if must appear alone on
             its input line or after an else.)

        jobs
        jobs -l
             Lists the active jobs; given the -l option lists process ids
             in addition to the normal information.

        kill %job
        kill -sig %job ...
        kill pid
        kill -sig pid ...
        kill -l
             Sends either the TERM (terminate) signal or the specified
             signal to the specified jobs or processes.  Signals are
             either given by number or by names (as given in
             /usr/include/signal.h, stripped of the prefix SIG).  The
             signal names are listed by kill -l.  There is no default, so
             just saying kill by itself does not send a signal to the
             current job.  If the signal being sent is TERM (terminate)
             or HUP (hangup), then the job or process will be sent a CONT
             (continue) signal as well.

        limit
        limit resource
        limit resource maximum-use
             Limits the consumption by the current process and each
             process it creates to not individually exceed maximum-use on
             the specified resource.  If no maximum-use is given, then
             the current limit is printed; if no resource is given, then
             all limitations are given.




        DG/UX 4.00                                                Page 17
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             Controllable resources include cputime (the maximum number
             of cpu-seconds to be used by each process); filesize (the
             largest single file which can be created); datasize (the
             maximum growth of the data+stack region via sbrk(2) beyond
             the end of the program text), stacksize (the maximum size of
             the automatically-extended stack region), and coredumpsize
             (the size of the largest core dump that will be created).

             The maximum-use can be a (floating point or integer) number
             followed by a scale factor.  For all limits other than
             cputime the default scale is k or kilobytes (1024 bytes); a
             scale factor of m or megabytes may also be used.  For
             cputime the default scaling is seconds, while m for minutes
             or h for hours, or a time of the form mm:ss giving minutes
             and seconds may be used.

             For both resource names and scale factors, use unambiguous
             prefixes of the names suffice.

        login
             Terminate a login shell, replacing it with an instance of
             /bin/login. This is one way to log off, included for
             compatibility with sh(1).

        logout
             Terminate a login shell.  Especially useful if ignoreeof is
             set.

        newgrp
             Changes the group identification of the caller; for details
             see newgrp(1).  A new shell is executed by newgrp so that
             the shell state is lost.

        nice
        nice +number
        nice command
        nice +number command
             Niceness is the willingness to run your job at a lower
             priority. The "nice" number is the factor that is added to
             your job's default priority. (Priority numbers are ordinal;
             that is, a higher priority number means a lower priority.)
             The first form sets the nice factor for this shell to 4 (the
             default).  The second form sets the nice factor to the given
             number.  The final two forms run command at (default
             priority + 4) and number, respectively.  The super-user may
             specify negative niceness by using "nice -number ...."
             Command is always executed in a sub-shell, and the
             restrictions placed on commands in simple if statements
             apply.

        nohup



        DG/UX 4.00                                                Page 18
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        nohup command
             The first form can be used in shell scripts to cause hangups
             to be ignored for the remainder of the script.  The second
             form causes the specified command to be run with hangups
             ignored.  All processes detached with & are effectively
             nohuped.

        notify
        notify %job ...
             Causes the shell to notify the user asynchronously when the
             status of the current or specified jobs changes; normally
             notification is presented before a prompt.  This is
             automatic if the shell variable notify is set.

        onintr
        onintr  -
        onintr  label
             Control the action of the shell on interrupts.  The first
             form restores the default action of the shell on interrupts.
             The default is to terminate shell scripts or to return to
             the terminal command input level.  The second form, onintr -
             causes all interrupts to be ignored.  The final form causes
             the shell to execute a goto label when an interrupt is
             received or a child process terminates because it was
             interrupted.

             If the shell is running detached and interrupts are being
             ignored, no form of onintr has meaning. Interrupts continue
             to be ignored by the shell and all invoked commands.

        popd
        popd +n
             Pops the directory stack, returning to the new top
             directory.  With an argument +n, the nth entry in the stack
             is discarded.  The elements of the directory stack are
             numbered from 0 starting at the top.

        pushd
        pushd name
        pushd +n
             With no arguments, pushd exchanges the top two elements of
             the directory stack.  Given a name argument, pushd changes
             to the new directory (ala cd) and pushes the old current
             working directory (as in csw) onto the directory stack.
             With a numeric argument, rotates the nth argument of the
             directory stack around to be the top element and changes to
             it.  The members of the directory stack are numbered from
             the top starting at 0.

        rehash
             Recomputes the internal hash table of the contents of the



        DG/UX 4.00                                                Page 19
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             directories in the path variable. This is needed if new
             commands are added to directories in the path while you are
             logged in.  This should only be necessary if you add
             commands to one of your own directories, or if a systems
             programmer changes the contents of one of the system
             directories.

        repeat count command
             Command is subject to the same restrictions as the command
             in the one-line if statement above.  It is executed count
             times.  I/O redirections occur exactly once, even if count
             is 0.

        set
        set name
        set name=word
        set name[index]=word
        set name=(wordlist)
             The first form of the command shows the value of all shell
             variables.  Variables with other than a single word as value
             appear as a parenthesized word list.  The second form sets
             name to the null string.  The third form sets name to the
             single word. The fourth form sets the indexth component of
             name to word ; this component must already exist.  The final
             form sets name to the list of words in wordlist. In all
             cases the value is command and filename expanded.

             These arguments may be repeated to set multiple values in a
             single set command.  Note however, that variable expansion
             happens for all arguments before any setting occurs.

        setenv name value
             Sets the value of environment variable name to value, a
             single string.  The most commonly used environment variable
             USER, TERM, and PATH are automatically imported to and
             exported from the csh variables user, term, and path; there
             is no need to use setenv for these.

        shift
        shift variable
             The members of argv are shifted to the left, discarding
             argv[1]. It is an error for argv not to be set or to have
             less than one word as value.  The second form performs the
             same function on the specified variable.

        source name
        source -h name
             The shell reads commands from name. Source commands may be
             nested; if they are nested too deeply the shell may run out
             of file descriptors.  An error in a source at any level
             terminates all nested source commands.  Normally, input



        DG/UX 4.00                                                Page 20
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             during source commands is not placed on the history list;
             the -h option causes the commands to be placed in the
             history list without being executed.

        stop
        stop %job ...
             Stops the current or specified job which is executing in the
             background.  Do not use stop 0 in a login shell (one that
             you are in after logging on).  It will hang your terminal.
             Also, you must be using the Berkeley line driver (stty line
             1) for stop and suspend signals to be handled properly.

        suspend
             Causes the shell to stop in its tracks, much as if it had
             been sent a stop signal with ^Z.  This is most often used to
             stop shells started by su(1).

        switch (string)
        case str1:
            ...
          breaksw
             ...
        default:
            ...
          breaksw
        endsw
             Each case label is successively matched against the
             specified string which is first command and filename
             expanded.  The file metacharacters *, ? and [...] may be
             used in the case labels, which are variable expanded.  If
             none of the labels match before a default label is found,
             then the execution begins after the default label.  Each
             case label and the default label must appear at the
             beginning of a line.  The command breaksw continues
             execution after the endsw. Otherwise, control may fall
             through case labels and default labels as in C.  If no label
             matches and there is no default, execution continues after
             the endsw.

        time
        time command
             With no argument, a summary of time and system resources
             used by this shell and its children is printed.  If
             arguments are given the specified simple command is timed
             and a summary of time and system resources used is printed.
             The information is printed in seven fields; we show the
             example of a "zero consumption" case with each field
             description:


             0.0u user time in seconds



        DG/UX 4.00                                                Page 21
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             0.0s system time in seconds

             0:00 real time in minutes and seconds

             0%   a rough approximation of the percentage of CPU cycles
                  used during real time, calculated by adding system and
                  user times and dividing the sum by elapsed real time

             0+0k shared and unshared memory-time, in kilobyte-seconds,
                  separated by +.

             0+0io
                  Number of blocks input and output, separated by +.

             0pf+0w
                  Number of page faults (pf) and number of times the
                  process was swapped out to disk (w).

        If necessary, an extra shell is created to print the time
        statistic when the command completes.  The time variable,
        mentioned below, can be set to a threshold; thereafter, time use
        information (system, user, real) is printed whenever any program
        or command exceeds that threshold.

        umask
        umask value
             The file creation mask is displayed (first form) or set to
             the specified value (second form).  The mask is given in
             octal.  Common values for the mask are 002, giving all
             access to the group and read and execute access to others;
             or 022, giving read and execute access only to users in the
             group or others. Note, however, that umask 000 is
             effectively umask 111; csh creates files with a default
             permission of 666, which means that no one (even the owner)
             has execute permission for the file.  Use chmod(1) to add
             execute permission. (Note that any file of shell or C-shell
             commands must have execute permission set in order to run).

        unalias pattern
             All aliases whose names match the specified pattern are
             discarded.  Thus all aliases are removed by unalias *.  It
             is not an error for nothing to be unaliased.

        unhash
             Disables the internal hash table from speeding up location
             of executed programs.

        unlimit resource
        unlimit
             Removes the limitation on resource.  If no resource is
             specified, then all resource limitations are removed.



        DG/UX 4.00                                                Page 22
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        unset pattern
             All variables whose names match the specified pattern are
             removed.  Thus all variables are removed by "unset *"; this
             has noticeably bad side-effects.  It is not an error for
             nothing to be unset.

        unsetenv pattern
             Removes all variables whose names match the specified
             pattern from the environment.  See also the setenv command
             above and printenv(1).

        wait
             All background jobs are waited for.  It the shell is
             interactive, then an interrupt can disrupt the wait, at
             which time the shell prints names and job numbers of all
             jobs known to be outstanding.

        while (expr)
            ...
        end
             While the specified expression evaluates non-zero, the
             commands between the while and the matching end are
             evaluated.  Break and continue can be used to terminate or
             continue the loop prematurely.  (The while and end must
             appear alone on their input lines.) Prompting occurs here
             the first time through the loop as for the foreach statement
             if the input is a terminal.

        %job
             Brings the specified job into the foreground.

        %job &
             Continues the specified job in the background.

        @
        @ name = expr
        @ name[index] = expr
             The first form prints the values of all the shell variables.
             The second form sets the specified name to the value of
             expr. If the expression contains <, >, & or | then at least
             this part of the expression must be placed within ( ).  The
             third form assigns the value of expr to the indexth argument
             of name. Both name and its indexth component must already
             exist.

             The operators *=, +=, etc are available as in C.  The space
             separating the name from the assignment operator is
             optional.  Spaces are, however, mandatory in separating
             components of expr which would otherwise be single words.

             Special postfix ++ and -- operators increment and decrement



        DG/UX 4.00                                                Page 23
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



             name respectively, i.e. @  i++.


        Pre-defined and environment variables

        NOTE:
             By convention, environment variables are uppercase, and
             local variables are lowercase.  The following variables have
             special meaning to the shell.  Of these, argv, cwd, home,
             path, prompt, shell and status are always set by the shell.
             Except for cwd and status this setting occurs only at
             initialization; these variables will not then be modified
             unless the user does it.

        This shell copies the environment variable USER into the variable
        user, TERM into term, and HOME into home, and copies these back
        into the environment whenever the normal shell variables are
        reset.  The environment variable PATH is likewise handled; its
        setting in the file .login is sufficient since inferior csh
        processes will import the definition of path from the
        environment, and re-export it if you then change it.

        argv           Set to the arguments to the shell, it is from this
                       variable that positional parameters are
                       substituted, i.e. $1 is replaced by $argv[1], etc.

        cdpath         Gives a list of alternate directories searched to
                       find subdirectories in chdir commands.

        cwd            The full pathname of the current directory.

        echo           Set when the -x command line option is given.
                       Causes each command and its arguments to be echoed
                       just before it is executed.  For non-built-in
                       commands, all expansions occur before echoing.
                       Built-in commands are echoed before command and
                       filename substitution, since these substitutions
                       are then done selectively.

        histchars      Can be given a string value to change the
                       characters used in history substitution.  The
                       first character of its value is used as the
                       history substitution character, replacing the
                       default character !.  The second character of its
                       value replaces the character ↑ in quick
                       substitutions.

        history        Can be given a numeric value to control the size
                       of the history list.  Any command that has been
                       referenced in this many events will not be
                       discarded.  Too-large values of history may run



        DG/UX 4.00                                                Page 24
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



                       the shell out of memory.  The last executed
                       command is always saved on the history list.

        home           The home directory of the invoker, initialized
                       from the environment.  The filename expansion of ~
                       refers to this variable.

        ignoreeof      If set, the shell ignores end-of-file from input
                       devices that are terminals.  This prevents shells
                       from accidentally being killed by control-Ds.

        mail           The files where the shell checks for mail.  This
                       is done after each command completion that will
                       result in a prompt, if a specified interval has
                       elapsed.  The shell says "You have new mail." if
                       the file exists with an access time not greater
                       than its modify time.

                       If the first word of the value of mail is numeric
                       it specifies a different mail checking interval,
                       in seconds, than the default, which is 10 minutes.

                       If multiple mail files are specified, then the
                       shell says "New mail in name " when there is mail
                       in the file name.

        noclobber      As described in the section on Input/output,
                       restrictions are placed on output redirection to
                       ensure that files are not accidentally destroyed,
                       and that >> redirections refer to existing files.

        noglob         If set, filename expansion is inhibited.  This is
                       most useful in shell scripts which are not dealing
                       with filenames, or after a list of filenames has
                       been obtained and further expansions are not
                       desirable.

        nonomatch      If set, it is not an error for a filename
                       expansion to not match any existing files; rather
                       the primitive pattern is returned.  It is still an
                       error for the primitive pattern to be malformed,
                       i.e.  echo [ still gives an error.

        notify         If set, the shell notifies asynchronously of job
                       completions.  The default is to present job
                       completions just before printing a prompt.

        path           Each word of the path variable specifies a
                       directory in which commands are to be sought for
                       execution.  A null word specifies the current
                       directory.  If there is no path variable then only



        DG/UX 4.00                                                Page 25
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



                       full pathnames will execute.  The usual search
                       path is ., /bin and /usr/bin, but this may vary
                       from system to system.  For the super-user the
                       default search path is /etc, /bin and /usr/bin.  A
                       shell command with neither the -c nor the -t
                       option will normally hash the contents of the
                       directories in the path variable after reading
                       .cshrc, and each time the path variable is reset.
                       If new commands are added to these directories
                       while the shell is active, you may need to give
                       the rehash in order to find the commands.

        prompt         The string printed before each command is read
                       from an interactive terminal input.  If a !
                       appears in the string it will be replaced by the
                       current event number unless a preceding \ is
                       given.  Default is % , or #  for the super-user.

        savehist       Is given a numeric value to control the number of
                       entries of the history list that are saved in
                       ~/.history when the user logs out.  Any command
                       that has been referenced in this many events will
                       be saved.  During start-up the shell sources
                       ~/.history into the history list enabling history
                       to be saved across logoins.  A large value of
                       savehist slows down the shell during start-up.

        shell          The file in which the shell resides.  This is used
                       in forking shells to interpret files that have
                       execute bits set, but which are not executable by
                       the system.  (See the description of Non-built-in
                       Command Execution below.) Initialized to the
                       (system-dependent) home of the shell.

        status         The status returned by the last command.  If it
                       terminated abnormally, then 0200 is added to the
                       status.  Built-in commands that fail return exit
                       status 1, all other built-in commands set status
                       0.

        time           Controls automatic timing of commands.  If set,
                       then any command which takes more than this many
                       CPU seconds will print a line when it terminates
                       giving user, system, and real times and a
                       utilization percentage which is the ratio of user
                       plus system times to real time.

        verbose        Set by the -v command line option, prints the
                       words of each command after history substitution.





        DG/UX 4.00                                                Page 26
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        Non-built-in command execution

        When a command to be executed is not a built-in command, the
        shell tries to execute the command via exec(2).  Each word in the
        variable path names a directory from which the shell will try to
        execute the command.  If it is given neither a -c nor a -t
        option, the shell will hash the names in these directories into
        an internal table; it will only try an exec in a directory if
        there is a possibility that the command resides there.  This
        greatly speeds command location when a large number of
        directories are present in the search path.

        If this mechanism has been turned off (via unhash), if the shell
        was given a -c or -t argument, or for each directory component of
        path which does not begin with a /, the shell concatenates with
        the given command name to form a pathname of a file which it then
        attempts to execute.

        Parenthesized commands are always executed in a subshell.  Thus
        (cd ; pwd) ; pwd prints the home directory; leaving you where you
        were (printing this after the home directory), while cd ; pwd
        leaves you in the home directory.  Parenthesized commands are
        most often used to prevent chdir from affecting the current
        shell.

        If the file has execute permissions but is not an executable
        binary to the system, then it is assumed to be a file containing
        shell commands and a new shell is spawned to read it.

        If there is an alias for shell then the words of the alias will
        be prepended to the argument list to form the shell command.  The
        first word of the alias should be the full pathname of the shell
        (e.g. $shell).  Note that this is a special, late occurring, case
        of alias substitution, and only lets unmodified words be
        prepended to the argument list.

        Argument list processing

        If argument 0 to the shell is - then this is a login shell.  The
        flag arguments are:

        -c   Commands are read from the (single) following argument which
             must be present.  Any remaining arguments are placed in
             argv.

        -e   The shell exits if any invoked command terminates abnormally
             or yields a non-zero exit status.

        -f   The shell will start faster, because it will neither search
             for nor execute commands from the file .cshrc in the
             invokers home directory.



        DG/UX 4.00                                                Page 27
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        -i   The shell is interactive and prompts for its top-level
             input, even if it appears to not be a terminal.  Shells are
             interactive without this option if their inputs and outputs
             are terminals.

        -n   Commands are parsed, but not executed.  This may aid in
             syntactic checking of shell scripts.

        -s   Command input is taken from the standard input.

        -t   A single line of input is read and executed.  A \ may be
             used to escape the new-line at the end of this line and
             continue onto another line.

        -v   Sets the verbose variable, with the effect that command
             input is echoed after history substitution.

        -x   Sets the echo variable, so that commands are echoed
             immediately before execution.

        -V   Sets the verbose variable even before .cshrc is executed.

        -X   Is to -x as -V is to -v.

        After processing of flag arguments if arguments remain but none
        of the -c, -i, -s, or -t options was given the first argument is
        taken as the name of a file of commands to be executed.  The
        shell opens this file, and saves its name for possible
        resubstitution by $0.  Since many systems use either the standard
        version 6 or version 7 shells whose shell scripts are not
        compatible with this shell, the shell will execute such a
        standard shell if the first two characters of a script are not
        #!.  Remaining arguments initialize the variable argv.

        Signal handling

        The shell normally ignores quit signals.  Jobs running detached
        (either by & or the bg or %... & commands) are immune to signals
        generated from the keyboard, including hangups.  Other signals
        have the values which the shell inherited from its parent.  The
        shell's handling of interrupts and terminate signals in shell
        scripts can be controlled by onintr. Login shells catch the
        terminate signal; otherwise this signal is passed on to children
        from the state in the shell's parent.  In no case are interrupts
        allowed when a login shell is reading the file .logout.


        FILES

        ~/.cshrc                 Read at beginning of execution by each
                                 shell.



        DG/UX 4.00                                                Page 28
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        ~/.login                 Read by login shell, after .cshrc at
                                 login.
        ~/.logout                Read by login shell, at logout.
        /bin/sh                  Standard shell (for shell scripts not
                                 starting with #!)
        /tmp/sh*                 Temporary file for <<.
        /etc/passwd              Source of home directories for ~name.


        LIMITATIONS

        Words can be no longer than 1024 characters.  The system limits
        argument lists to 10240 characters.  The number of arguments to a
        command that involves filename expansion is limited to one-sixth
        the number of characters allowed in an argument list.  Command
        substitutions may substitute no more characters than are allowed
        in an argument list.  To detect looping, the shell restricts the
        number of alias substititutions on a single line to 20.


        SEE ALSO

        sh(1).
        access(2), exec(2), fork(2), killpg(2), pipe(2), sigsys(2),
        umask(2), vlimit(2), wait(2), jobs(3), sigset(3), a.out(4),
        environ(5) in the Programmer's Reference for the DG/UX System.
        tty(7) in the System Manager's Reference for the DG/UX System.


        NOTES

        When a command is restarted from a stop, the shell prints the
        directory it started in if this is different from the current
        directory; this can be misleading, since the job may have changed
        directories internally.

        If a process reading from a pipe ends before the process writing
        to the pipe, a harmless "Broken Pipe" error message is printed.
        Example:  ls -l | head in a large directory.

        Shell built-in functions are not stoppable/restartable.  Command
        sequences of the form a ; b ; c are also not handled gracefully
        when stopping is attempted.  If you suspend b, the shell will
        then immediately execute c.  This is especially noticeable if
        this expansion results from an alias.  Placing the sequence of
        commands in parentheses to force it to a subshell, i.e.  ( a ; b
        ; c ), will suffice.

        Control over tty output after processes are started is primitive;
        perhaps this will inspire someone to work on a good virtual
        terminal interface.  In a virtual terminal interface much more



        DG/UX 4.00                                                Page 29
               Licensed material--property of copyright holder(s)





                                                                   csh(1)



        interesting things could be done with output control.

        Alias substitution is most often used to clumsily simulate shell
        procedures; shell procedures should be provided rather than
        aliases.

        Commands within loops, prompted for by ?, are not placed in the
        history list.  Control structure should be parsed rather than
        being recognized as built-in commands.  This would let you place
        control commands anywhere, to be combined with |, and to be used
        with & and ; metasyntax.

        It should be possible to use the : modifiers on the output of
        command substitutions.  All and more than one : modifier should
        be allowed on $ substitutions.







































        DG/UX 4.00                                                Page 30
               Licensed material--property of copyright holder(s)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026