I am trying to prepare a shell script to include several chained sed commands.
I am using /bin/sh
in FreeBSD 12. Which seems to be POSIX compliant (see man page here).
This is what I have tried, it can be clearly seen that the behaviour is not the expected one:
$ cat testfile.txt
<TEST>
$ cat test.sh
#!/bin/sh
while read line
do
sed 's/<TEST>/FOO/'
done <&0
$ cat testfile.txt | ./test.sh
$ cat testfile.txt | sed 's/<TEST>/FOO/'
FOO
$
I guess I am missing something basic here.