problem with suppressed output to file using echo and tee command

Hi,

When I run the following command in terminal it works. The string TEST is appended to a file silently.

echo TEST | tee -a file.txt &>/dev/null

However, when I paste this same line to a file, say shell1.sh, and use bourne shell .

I run this file in terminal, ./shell1.sh.
However I still get the output TEST in the display. Is this some kind of limitation of bourne shell. How can I suppress this output?

remove the &. that is unecessary. what shell/OS?

if you don't care to see the output then don't use tee. just do this

echo TEST >> file.txt
1 Like