# how to use builtins?



## KorlaPlankton (Oct 12, 2011)

Hi everyone,

First of all sorry for the newbish question. Basically, I need the syntax for the 'read' command. If I read the man page for read, i get the page for builtins but this does not have the syntax.

As you might imagine, googling for anything related to a command called 'read' gives results that are .... ironic, i guess. Lots of stuff about how i should read manual pages  "I want to!" I tell it but that's no help.

So how might I figure this out short of examining source code?

thanks,
K. Plankton


----------



## Carpetsmoker (Oct 12, 2011)

You need look at the manpage of your shell, which is sh(1) or tcsh(1).

For _read_ you're probably talking about a shell script and thus sh.

The sh manpage is very long, but search it for "Built-in Commands", this gives you a list of all built-ins with explanation


```
read [-p prompt] [-t timeout] [-er] variable ...
             The prompt is printed if the -p option is specified and the stanâ€
             dard input is a terminal.  Then a line is read from the standard
             input.  The trailing newline is deleted from the line and the
             line is split as described in the section on White Space
             Splitting (Field Splitting) above, and the pieces are assigned to
             the variables in order.  If there are more pieces than variables,
             the remaining pieces (along with the characters in IFS that sepaâ€
             rated them) are assigned to the last variable.  If there are more
             variables than pieces, the remaining variables are assigned the
             null string.

             Backslashes are treated specially, unless the -r option is speciâ€
             fied.  If a backslash is followed by a newline, the backslash and
             the newline will be deleted.  If a backslash is followed by any
             other character, the backslash will be deleted and the following
             character will be treated as though it were not in IFS, even if
             it is.

             If the -t option is specified and the timeout elapses before a
             complete line of input is supplied, the read command will return
             an exit status of 1 without assigning any values.  The timeout
             value may optionally be followed by one of â€˜sâ€™, â€˜mâ€™ or â€˜hâ€™ to
             explicitly specify seconds, minutes or hours.  If none is supâ€
             plied, â€˜sâ€™ is assumed.

             The -e option exists only for backward compatibility with older
             scripts.
```


----------



## KorlaPlankton (Oct 12, 2011)

Thank you very much! I knew that information had to be somewhere.


----------

