shell - How to store the output of a Bash command inside >() in a variable? -
i have this:
tee < /some/big/file >(wc -c) >(md5sum) | ...
instead of writing results of wc -c
, md5sum
stdout, want store results 2 variables later processing. don't want read file more once. how can accomplish that?
you can fifo , temporary files.
input=/some/big/file mkfifo tmp wc -l <tmp >wc.out & md5=$(tee <"$input" tmp | md5sum) fg lines=$(cat wc.out) rm tmp rm wc.out
Comments
Post a Comment