Concurrently Running dd and md5sum Commands
Is there a way to merge the following two commands?
Code:
dd if=$DEVNODE of=$TMPDIR/$FILENAME bs=2048 conv=sync,notrunc Running dd twice is doable but time consuming. P.S. I 'm not trying to concatentate the two commands on one line using the '&&' parameter. I'm trying to run dd only once. Thanks again. |
See here:
http://www.linuxquestions.org/questi...8/#post3458795 Another option is the check program, it's also in the above thread. |
Hmm, the problem you'll have is that should your input file not be an exact multiple of your blocksize, the conv=sync will pad the end of output file as it passes through dd. This will mean that your md5sum will differ from a md5sum of the input (the two files will be of different sizes).
If you don't need the conv=sync then you should be able generate a md5sum and do the dd at the same time with something along the lines of: Code:
md5sum <(dd if=infile | tee -f ouputfile) |
Quote:
The basic command seems to succeed without the -f option --- I could find no -f option in the tee man page and I received an error message with -f. Seems to work but is the md5sum output that of infile or outputfile? The md5sum output is from /dev/fd/63. Similarly: MD5SUMDISK="`dd if=$DEVNODE | tee $FILENAME | md5sum | awk '{print $1}'`" Because tee splits the output, I don't know which MD5SUM is being reported. :scratch: :) |
Quote:
And yes, you're quite right, It appears I made the -f up. Been a while since I've used tee. Sorry 'bout that. edit: oh, and the <( ) shell syntax generates a fifo/named pipe, which explains the wierd /dev/fd name. You'll need to code your script to replace that with the name of the output file on the tee if you store the output of the md5sum for later use. |
All times are GMT -5. The time now is 03:33 PM. |