;;; Gash -- Guile As SHell ;;; Copyright © 2019 Timothy Sample ;;; ;;; This file is part of Gash. ;;; ;;; Gash is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; ;;; Gash is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with Gash. If not, see . * Reads a single variable :script: #+begin_src sh echo foo | { read x echo $x } #+end_src :stdout: #+begin_example foo #+end_example * Reads multiple variables :script: #+begin_src sh echo foo bar | { read x y echo $x echo $y } #+end_src :stdout: #+begin_example foo bar #+end_example * Handles more variables than fields :script: #+begin_src sh echo foo bar baz | { read x y echo $x echo $y } #+end_src :stdout: #+begin_example foo bar baz #+end_example * Handles more fields than variables :script: #+begin_src sh echo foo | { read x y echo $x echo $y } #+end_src :stdout: #+begin_example foo #+end_example * Trims whitespace in extra fields :script: #+begin_src sh echo foo bar 'baz ' | { read x y echo $x echo $y } #+end_src :stdout: #+begin_example foo bar baz #+end_example * Allows escaping line breaks :script: #+begin_src sh echo 'foo\ bar' | { read x echo $x } #+end_src :stdout: #+begin_example foobar #+end_example * Understands raw input flag :script: #+begin_src sh echo 'foo\ bar' | { read -r x echo $x } #+end_src :stdout: #+begin_example foo\ #+end_example