aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-07-25 11:41:08 -0300
committerEuAndreh <eu@euandre.org>2018-07-25 11:41:08 -0300
commit2878959c177b1eb1edabb214b5a40da3ef8528f6 (patch)
tree2e5e16c7b04f667d146beba6fe0cd1cbc176f8be
parentIndent bash code with 2 spaces instead of 4 (diff)
downloaddotfiles-2878959c177b1eb1edabb214b5a40da3ef8528f6.tar.gz
dotfiles-2878959c177b1eb1edabb214b5a40da3ef8528f6.tar.xz
Remove inline comments: doesn't work with pipe
-rw-r--r--bash/util.sh10
1 files changed, 5 insertions, 5 deletions
diff --git a/bash/util.sh b/bash/util.sh
index cdf4fd5..4fc11ab 100644
--- a/bash/util.sh
+++ b/bash/util.sh
@@ -24,9 +24,9 @@ extract () {
merkle-tree () {
dirname="${1-.}"
- find "$dirname" -type f | \ # get all files in the $dirname tree
- sort | \ # sort them to get the same result on different filesystems
- xargs sha256sum | \ # compute the SHA256 of each file, BONUS it outputs the filename, so if the content does not change but the filename does, the end hash will be different
- sha256sum | \ # compute the final hash
- awk '{print $1}' # omit the filename, which is `-` as stdin in this case
+ find "$dirname" -type f | \
+ sort | \
+ xargs -I{} sha256sum "{}" | \
+ sha256sum | \
+ awk '{print $1}'
}