bash:files:read_a_file:read_from_an_interactive_shell
Differences
This shows you the differences between two versions of the page.
bash:files:read_a_file:read_from_an_interactive_shell [2021/01/26 13:45] – created peter | bash:files:read_a_file:read_from_an_interactive_shell [2021/01/26 13:56] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== BASH - Files - Read a file - Read from an interactive shell ====== | ====== BASH - Files - Read a file - Read from an interactive shell ====== | ||
+ | |||
+ | <code bash> | ||
+ | read foo | ||
+ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== Handling backslash interpretation ====== | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * **-r**: | ||
+ | * Without this option, any unescaped backslashes in the input will be discarded. | ||
+ | * You should almost always use the **-r** option with read. | ||
+ | |||
+ | The most common exception to this rule is when **-e** is used, which uses Readline to obtain the line from an interactive shell. | ||
+ | |||
+ | * In that case, tab completion will add backslashes to escape spaces and such, and you do not want them to be literally included in the variable. | ||
+ | * This would never be used when reading anything line-by-line, | ||
+ | |||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | |||
+ | |||
bash/files/read_a_file/read_from_an_interactive_shell.1611668742.txt.gz · Last modified: 2021/01/26 13:45 by peter