how to suppress dd output?

I have to stop the output of dd from writing to terminal. Here is the command:

sudo dd if=boot1h of="/dev/r$temp1"

Here is the output:

2+0 records in
2+0 records out
1024 bytes transferred in 0.000804 secs (1273715 bytes/sec)

I have tried >> log.txt but it doesn't work. Is there another way to stop this output?

Hi.

The output you see goes to standard error, so:

sudo dd if=boot1h of="/dev/r$temp1" 2> /dev/null

should get rid of it.

Thanks for the replay. I was just reading about suppressing to the null device. This works for me:

sudo dd if=boot1h of="/dev/r$temp1" >& /dev/null

For future reference, can you explain the difference between the two methods (<& and 2>)?

I believe that

blah >& outfile

is shorthand for

blah > outfile 2>&1

(but I think it's a bash thing, and I never use it, or bash, so...)

I/O Redirection