diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-02 00:18:50 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-02 00:18:50 +1200 |
commit | 62dbc06c52f460ec297a3c3c48db77f04f285d0f (patch) | |
tree | 3754774e63260c0bf9899da8c17af7bcdf31deb2 | |
parent | Fix POSIX non-compliance in cfr(1) (diff) | |
download | dotfiles-62dbc06c52f460ec297a3c3c48db77f04f285d0f.tar.gz dotfiles-62dbc06c52f460ec297a3c3c48db77f04f285d0f.zip |
Add tot(1df)
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | README.markdown | 1 | ||||
-rw-r--r-- | bin/tot.awk | 3 | ||||
-rw-r--r-- | man/man1/tot.1df | 19 |
5 files changed, 27 insertions, 1 deletions
@@ -4,6 +4,7 @@ bin/rndi bin/sd2u bin/slsf bin/su2d +bin/tot bin/unf games/acq games/kvlt @@ -72,6 +72,7 @@ all : bin/han \ bin/sd2u \ bin/slsf \ bin/su2d \ + bin/tot \ bin/unf \ git/gitconfig \ gnupg/gpg.conf \ @@ -85,6 +86,7 @@ clean distclean : bin/sd2u \ bin/slsf \ bin/su2d \ + bin/tot \ bin/unf \ games/acq \ games/kvlt \ @@ -169,7 +171,7 @@ install-bash-completion : install-bash install -pm 0644 -- bash/bash_completion "$(HOME)"/.config/bash_completion install -pm 0644 -- bash/bash_completion.d/* "$(HOME)"/.bash_completion.d -install-bin : bin/han bin/sd2u bin/su2d bin/unf check-bin install-bin-man +install-bin : bin/han bin/sd2u bin/su2d bin/tot bin/unf check-bin install-bin-man install -m 0755 -d -- "$(HOME)"/.local/bin for name in bin/* ; do \ [ -x "$$name" ] || continue ; \ diff --git a/README.markdown b/README.markdown index cc784678..6bc5d1f0 100644 --- a/README.markdown +++ b/README.markdown @@ -441,6 +441,7 @@ Installed by the `install-bin` target: privileges. * `td(1df)` manages a to-do file for you with `$EDITOR` and `git(1)`; I used to use Taskwarrior, but found it too complex and buggy. +* `tot(1df)` adds up a list of integers. * `try(1df)` repeats a command up to a given number of times until it succeeds, only printing error output if all three attempts failed. Good for tolerating blips or temporary failures in `cron(8)` scripts. diff --git a/bin/tot.awk b/bin/tot.awk new file mode 100644 index 00000000..c25c718d --- /dev/null +++ b/bin/tot.awk @@ -0,0 +1,3 @@ +# Total a column of integers +{ tot += $1 } +END { printf "%u\n", tot } diff --git a/man/man1/tot.1df b/man/man1/tot.1df new file mode 100644 index 00000000..c098cbe1 --- /dev/null +++ b/man/man1/tot.1df @@ -0,0 +1,19 @@ +.TH TOT 1df "September 2016" "Manual page for tot" +.SH NAME +.B tot +\- print a count of entries in a directory +.SH SYNOPSIS +printf '%u\\n' 5 9 53 145 | +.B tot +.br +.B tot +file +.br +.B tot +file1 file2 +.SH DESCRIPTION +.B tot +adds up all the newline-delimited integers given as input, and prints the +total. +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |