Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
  2. One line is read from the standard input, or from the file descriptor fd supplied as an argument to the -u option, and the first word is assigned to the
  3. first name, the second word to the second name, and so on, with leftover words and their intervening separators assigned to the last name. If there are
  4. fewer words read from the input stream than names, the remaining names are assigned empty values. The characters in IFS are used to split the line into
  5. words using the same rules the shell uses for expansion (described above under Word Splitting). The backslash character (\) may be used to remove any
  6. special meaning for the next character read and for line continuation. Options, if supplied, have the following meanings:
  7. -a aname
  8. The words are assigned to sequential indices of the array variable aname, starting at 0. aname is unset before any new values are assigned.
  9. Other name arguments are ignored.
  10. -d delim
  11. The first character of delim is used to terminate the input line, rather than newline.
  12. -e If the standard input is coming from a terminal, readline (see READLINE above) is used to obtain the line. Readline uses the current (or
  13. default, if line editing was not previously active) editing settings.
  14. -i text
  15. If readline is being used to read the line, text is placed into the editing buffer before editing begins.
  16. -n nchars
  17. read returns after reading nchars characters rather than waiting for a complete line of input, but honor a delimiter if fewer than nchars charac‐
  18. ters are read before the delimiter.
  19. -N nchars
  20. read returns after reading exactly nchars characters rather than waiting for a complete line of input, unless EOF is encountered or read times
  21. out. Delimiter characters encountered in the input are not treated specially and do not cause read to return until nchars characters are read.
  22. -p prompt
  23. Display prompt on standard error, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is com‐
  24. ing from a terminal.
  25. -r Backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may
  26. not be used as a line continuation.
  27. -s Silent mode. If input is coming from a terminal, characters are not echoed.
  28. -t timeout
  29. Cause read to time out and return failure if a complete line of input (or a specified number of characters) is not read within timeout seconds.
  30. timeout may be a decimal number with a fractional portion following the decimal point. This option is only effective if read is reading input
  31. from a terminal, pipe, or other special file; it has no effect when reading from regular files. If read times out, read saves any partial input
  32. read into the specified variable name. If timeout is 0, read returns immediately, without trying to read any data. The exit status is 0 if
  33. input is available on the specified file descriptor, non-zero otherwise. The exit status is greater than 128 if the timeout is exceeded.
  34. -u fd Read input from file descriptor fd.
  35.  
  36. If no names are supplied, the line read is assigned to the variable REPLY. The return code is zero, unless end-of-file is encountered, read times out
  37. (in which case the return code is greater than 128), a variable assignment error (such as assigning to a readonly variable) occurs, or an invalid file
  38. descriptor is supplied as the argument to -u.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement