summaryrefslogtreecommitdiffhomepage
path: root/tests/zash/stdin-script.sh
blob: 676ba7ffbecb7b646d4d1d935117127bf57633ce (plain)
1
2
3
4
5
6
7
8
9
# A script on stdin shares stdin with the commands it runs: the shell must
# not read ahead of the command it is executing.
printf 'read v\ndata line\necho "v=$v"\n' | $TSH
printf 'read v\ndata line\necho "v=$v"\n' >in.sh; $TSH <in.sh
printf 'cat\npassed to cat\n' >in2.sh; $TSH <in2.sh
printf 'cat\npassed to cat\n' | $TSH
printf 'head -1\nline for head\necho after\n' >in3.sh; $TSH <in3.sh
printf 'read a; read b\nl1\nl2\necho "$a $b"\n' | $TSH
$TSH /nonexistent/script 2>/dev/null; echo "noscript $?"