[prog] echoing something to STDERR

Hamster hamster at hamsternet.org
Tue Nov 11 22:20:58 EST 2003


On Tue, 11 Nov 2003 21:14:39 +0100
Hamster <hamster at hamsternet.org> wrote:


> [ -f foo.txt ] || echo "foo.txt doesnt exist" 
> 
> The problem with this is that echo plonks stuff on STDOUT, I want it to go
> to STDERR.
> 
> How do I do that?

Sigh, forgot to mention that I found one way of doing it, 


[ -f foo.txt ] || echo "foo.txt doesnt exist" >&2

But is this the only way??

Hamster



More information about the Programming mailing list