echo bug?

Smoot Carl-Mitchell smoot at tic.com
Sat Sep 12 19:06:31 UTC 2009


On Sat, 2009-09-12 at 19:40 +0200, Nils Kassube wrote:
> Karl Auer wrote:
> >    #!/bin/sh
> >    cat >> $1
> >
> > Now you can do this:
> >
> >    echo blah | sudo acat some_file
> >
> > ... and "blah" will be appended to some_file, even though it is owned
> > by root.
> 
> Great - a shell script version of the tee program. :)

Not quite tee, since tee also writes to stdout.  A tee version of the
above would be:

echo foo | sudo tee -a some_file >/dev/null
-- 
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005




More information about the ubuntu-users mailing list