commands:builtin:read

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
commands:builtin:read [2017/05/12 23:39]
greywolf [Description] Added a second method to avoid having to muck about with IFS (doing so can be prone to operator error, i.e. forgetting to reset IFS to something sane)
commands:builtin:read [2020/06/27 08:35]
thebonsai -e works with -u since 5.1 alpha
Line 4: Line 4:
 ===== Synopsis ===== ===== Synopsis =====
 <​code>​ <​code>​
-read [-ers] [-u <FD>] [-t <​TIMEOUT>​] [-p <​PROMPT>​] [-a <​ARRAY>​] [-n <​NCHARS>​] [-d <​DELIM>​] [-i <​TEXT>​] [<​NAME...>​]+read [-ers] [-u <FD>] [-t <​TIMEOUT>​] [-p <​PROMPT>​] [-a <​ARRAY>​] [-n <​NCHARS>​] [-N <​NCHARS>​] [-d <​DELIM>​] [-i <​TEXT>​] [<​NAME...>​]
 </​code>​ </​code>​
  
Line 51: Line 51:
 |''​-a <​ARRAY>''​|read the data word-wise into the specified array ''<​ARRAY>''​ instead of normal variables| |''​-a <​ARRAY>''​|read the data word-wise into the specified array ''<​ARRAY>''​ instead of normal variables|
 |''​-d <​DELIM>''​|recognize ''<​DELIM>''​ as data-end, rather than ''<​newline>''​| |''​-d <​DELIM>''​|recognize ''<​DELIM>''​ as data-end, rather than ''<​newline>''​|
-|''​-e''​|on interactive shells: use Bash's readline interface to read the data|+|''​-e''​|on interactive shells: use Bash's readline interface to read the data. Since version 5.1-alpha, this can also be used on specified file descriptors using ''​-u''​|
 |''​-i <​STRING>''​|preloads the input buffer with text from ''<​STRING>'',​ only works when Readline (''​-e''​) is used| |''​-i <​STRING>''​|preloads the input buffer with text from ''<​STRING>'',​ only works when Readline (''​-e''​) is used|
 |''​-n <​NCHARS>''​|reads ''<​NCHARS>''​ characters of input, then quits| |''​-n <​NCHARS>''​|reads ''<​NCHARS>''​ characters of input, then quits|
  • commands/builtin/read.txt
  • Last modified: 2020/06/27 08:35
  • by thebonsai