2.7 KiB
- iohere-builtin
- iohere
- redirect-append
- redirect-clobber
- redirect-in-out
- redirect-in
- redirect-pipe
- redirect-sed
- redirect
- redirect-space
;;; Gash – Guile As SHell ;;; Copyright © 2016, 2017, 2018 R.E.W. van Beusekom <rutger.van.beusekom@gmail.com> ;;; Copyright © 2018, 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com> ;;; ;;; 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 <http://www.gnu.org/licenses/>.
iohere-builtin
\cat <<EOF
foobar
EOF
iohere
cat <<EOF
foobar
EOF
:STDOUT:
foobar
redirect-append
echo foo > $TEST_TMP/bar
echo foo >> $TEST_TMP/bar
cat $TEST_TMP/bar
rm $TEST_TMP/bar
:STDOUT:
foo foo
redirect-clobber
echo foo > /tmp/bar$$
cat /tmp/bar$$
> /tmp/bar$$
cat /tmp/bar$$
:STDOUT:
foo
redirect-in-out
cat < tests/data/foo > /tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$
:STDOUT:
foo bar baz
redirect-in
\cat < tests/data/foo
;; * redirect-merge ;; :script: ;; #+begin_src sh ;; set +e ;; ls /bin/sh /bin/foo > bar 2>&1 ;; echo foo ;; cat bar ;; rm bar ;; #+end_src ;; :stdout: ;; #+begin_example ;; foo ;; ls: cannot access '/bin/foo': No such file or directory ;; /bin/sh ;; #+end_example
redirect-pipe
echo foo | grep foo 2>/dev/null
:STDOUT:
foo
redirect-sed
unset DESTDIR
sed \
-e "s,^#! /bin/sh,#! /bin/GASH," \
tests/data/diff.scm > $DESTDIR/tmp/diff.scm
cat $DESTDIR/tmp/diff.scm
rm $DESTDIR/tmp/diff.scm
:STDOUT:
#! /bin/GASH !#
redirect
echo foo 1>/tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$
:STDOUT:
foo
redirect-space
echo foo > /tmp/bar$$
cat /tmp/bar$$
rm /tmp/bar$$
:STDOUT:
foo