Well, the task is simple: a part of my script has to compute both md5 and sha1 hashes. The input is a file - big file - and hashes have to be put into MD and SH variables for later output composition.
While the processed files are realy big (hundreds of GB) I try to use some kind of multiple use of data once read. I found something called process substitution what I adopted in the next way:
$ dd if=big.tgz 2>/dev/null |tee >(sha1sum ) > >(md5sum ) ;
$ SH=$(sha1sum big.tgz); MD=$(md5sum big.tgz);
But I found the next:
there is apparently no resource neither time saving as both takes aprox. 40s (for 4.776 GB file)
I have no idea how to save the result of the subprocess
>(md5sum )into the variable MD to use it later in the script
I tried to understand the pipexec but even the nice color illustrations no success until yet.
Is there some other way to redirect the output to a vriable, other than VAR=$(command) ?