Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ colon(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ksh(1)

sh(1)

true(1)

colon(1)                                                           colon(1)

NAME
     colon, : - return zero exit status

SYNTAX
     :[ argument]...

DESCRIPTION
     The shell built-in : (colon) returns zero exit status and does nothing
     else. It is used in shell scripts in the following way:

     -  Without command-line arguments, it does exactly the same as the
        true(1) command. This means that you can also create the condition
        "true" using the shell built-in :.

     -  If you include arguments, the shell interprets all metacharacters
        that appear in them. This method of using the shell built-in :
        enables you to assign a default value to free shell variables
        without initiating any other action [see sh(1), section Defining
        default values for shell parameters].

     -  If you do not use any shell metacharacters in the command-line
        arguments, or if you escape them, the shell built-in : has the same
        function as the hash character #, i.e. it introduces comments. With
        :, though, unlike #, the next unescaped command separator termi-
        nates the comment.

ARGUMENTS
     argument
          Any string delimited by blanks or tabs. The last argument must be
          terminated by a command separator.

          You can specify any number of arguments, provided they are sepa-
          rated by at least one tab or blank.

          As with every other command, the string is first interpreted by
          the shell [see sh(1)]. The shell built-in : returns only a zero
          exit status.

          argument not specified:

          The shell built-in : returns only a zero exit status and does
          nothing else.

EXIT STATUS
     0    in every case

EXAMPLES
     Example 1:

     You can use the shell built-in : to fill in a branch of an if or case
     construct if you do not want anything to happen in that branch. Sup-
     pose the shell script notx contains the following:



Page 1                       Reliant UNIX 5.44                Printed 11/98

colon(1)                                                           colon(1)

     if test -x $1
     then :
     else echo $1 is not executable!
     fi

     This shell script tests the file that you name as your first command-
     line argument. If the file is executable, the shell script does noth-
     ing; otherwise, the message "file is not executable!" is issued.

     Example 2:

     The following shell script assigns the process ID of the current shell
     process to the shell variable name if this variable is undefined or
     contains the null string:

     : ${name:=$$}
     echo $name

SEE ALSO
     ksh(1), sh(1), true(1).


































Page 2                       Reliant UNIX 5.44                Printed 11/98

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