*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> read (1)              


 read(1)                                                             read(1)

 NAME    [Toc]    [Back]
      read - read a line from standard input

 SYNOPSIS    [Toc]    [Back]
      read [-r] var ...

 DESCRIPTION    [Toc]    [Back]
      read reads a single line from standard input.  The line is split into
      fields as when processed by the shell (refer to shells in SEE ALSO);
      the first field is assigned to the first variable var, the second
      field to the second variable var, and so forth.  If there are more
      fields than there are specified var operands, the remaining fields and
      their intervening separators are assigned to the last var.  If there
      are more vars than fields, the remaining vars are set to empty

      The setting of variables specified by the var operands affect the
      current shell execution environment.

      Standard input to read can be redirected from a text file.

      Since read affects the current shell execution environment, it is
      usually provided as a normal shell special (built-in) command.  Thus,
      if it is called in a subshell or separate utility execution
      environment similar to the following, it does not affect the shell
      variables in the caller's environment:

           (read foo)
           nohup read ...
           find . -exec read ... ;

    Options and Arguments    [Toc]    [Back]
      read recognizes the following options and command-line arguments:

           -r             Do not treat a backslash character in any special
                          way.  Consider each backslash to be part of the
                          input line.

           var            The name of an existing or non-existing shell

    Environment Variables
      IFS determines the internal field separators used to delimit fields.

 RETURN VALUE    [Toc]    [Back]
      read exits with one of the following values:

            0   Successful completion.

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 read(1)                                                             read(1)

           >0   End-of-file was detected or an error occurred.

 EXAMPLES    [Toc]    [Back]
      Print a file with the first field of each line moved to the end of the

           while read -r xx yy
                   printf "%s %s \n" "$yy" "$xx"
           done < input_file

 SEE ALSO    [Toc]    [Back]
      csh(1), ksh(1), sh-posix(1), sh(1).

      read:  SVID2, XPG2, XPG3, XPG4, POSIX.2 FIPS

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
tee Linux read from standard input and write to standard output and files
read Tru64 Reads a line from standard input
line Tru64 Reads one line from standard input
getwchar Linux read a wide character from standard input
line HP-UX read one line from user input
encrypt OpenBSD encrypt passwords from the command line or standard input
makekey OpenBSD encrypt passwords from the command line or standard input
line IRIX read one line
bad144 OpenBSD read/write DEC standard 144 bad sector information
gets IRIX Read a line from a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service