I use ed
in a bash script to search a file; the /
command will display the content, which I don't want. I tried to redirect >/dev/null 2>&1
but that didn't work for me.
text file foo.txt
:
a
b
c
bash script bar.sh
:
ed -s foo.txt << EOF
/b/
EOF
> /dev/null 2>&1
result:
$ ./bar.sh
b
How can I stop ed
printing the matched line b
?