The checksum and pipe are entered simultaneously.

I want to reliably move a large file from one computer to another, where it must be processed before saving.

I thought of transferring the file to ssh by executing a script processing.

local.example.com$ cat file | ssh remote.example.com process.sh

(If you have an idea better than mine, please suggest)

In the script process, I want both checksums and encrypt the file before saving. And here a problem arises.

Solutions can be two:

  • pipe input into two commands (cksum and openssl); but all the paths that I found looked complicated and optional.
  • hack cksum also does work with the cat and prints the result to stderr so that I can do

    cksum --pipe | openssl enc > myfile
    

    and return the checksum via stderr. Unfortunately, I looked at the code, and it seems to me that this is difficult to do without sacrificing performance / buffering;)

, cksumming, , . .

.

: http://www.linuxjournal.com/content/shell-process-redirection

+3
1

script cat > inputfile, STDIN EOF, script , .

tee;

echo foo | tee >(sha1sum) >(md5sum)
d3b07384d113edec49eaa6238ad5ff00  -
f1d2d2f924e986ac86fdf7b36c94bcdf32beec15  -
+4

All Articles