aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2018-07-26 09:23:57 -0300
committerEuAndreh <eu@euandre.org>2018-07-26 09:23:57 -0300
commite0aa824e55d977be49606ec9464286aaf8e89bcd (patch)
treebe011b1d352b320ae150d7aecc345eb28e374674
parentAdd keybind for relaoding projectile known projects (diff)
downloaddotfiles-e0aa824e55d977be49606ec9464286aaf8e89bcd.tar.gz
dotfiles-e0aa824e55d977be49606ec9464286aaf8e89bcd.tar.xz
Use pushd+popd in merkle-tree to simplify usage
This way the end hash doesn't change whenever it is run from different directories.
-rw-r--r--bash/util.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/bash/util.sh b/bash/util.sh
index 4fc11ab..833bc9c 100644
--- a/bash/util.sh
+++ b/bash/util.sh
@@ -24,9 +24,11 @@ extract () {
merkle-tree () {
dirname="${1-.}"
- find "$dirname" -type f | \
+ pushd "$dirname" > /dev/null
+ find . -type f | \
sort | \
xargs -I{} sha256sum "{}" | \
sha256sum | \
awk '{print $1}'
+ popd > /dev/null
}