diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-03-12 07:48:15 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-03-12 07:48:15 +0100 |
| commit | d3670965eaf950173c7d74b7fc498d8bd98e14f2 (patch) | |
| tree | dcc6c2ff446a1d76168244ce0f0c0c39df61fbaa /scripts/update-count.sh | |
| parent | b454da43ca724512c36402e27b7575092c5ea364 (diff) | |
| download | memory-leaks-d3670965eaf950173c7d74b7fc498d8bd98e14f2.tar.xz | |
Move all scripts under a new folder
This folder will be used to hold all website-building code.
At least until I change my mind and figure it's better to do it
otherwise.
Diffstat (limited to 'scripts/update-count.sh')
| -rwxr-xr-x | scripts/update-count.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/update-count.sh b/scripts/update-count.sh new file mode 100755 index 0000000..d0a094e --- /dev/null +++ b/scripts/update-count.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +list-tracked () +{ + GIT_LITERAL_PATHSPECS='' git ls-files '*.md' '*.org' +} + +count-leaks () +{ + let pages=0 + let words=0 + + while read filename + do + let words+=$(git show HEAD:${filename} | wc -w | cut -d' ' -f1) + let pages+=1 + done + + echo ${words} ${pages} +} + + + +read words pages < <(list-tracked | count-leaks) + +pattern="[0-9]* words in [0-9]* pages" +actual="${words} words in ${pages} pages" + +sed -i "s/${pattern}/${actual}/" README.md |
