diff --git a/doc_src/read.txt b/doc_src/read.txt index 3f41a871b..5514bc848 100644 --- a/doc_src/read.txt +++ b/doc_src/read.txt @@ -51,4 +51,9 @@ The following code stores the value 'hello' in the shell variable `$foo`. \fish echo hello|read foo + +# This is a neat way to handle command output by-line: +printf '%s\n' line1 line2 line3 line4 | while read -l foo + echo "This is another line: $foo" + end \endfish