From 0fb5f2c36bad79a167a258b50af9f331a7af1436 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sun, 8 Dec 2019 23:38:38 -0500 Subject: [PATCH] bin: a new binginning I used to use 'bin' for my setup scripts, so its history will undoubtably be confusing. However, I've recently (through reading The UNIX Programming Environment) become a fan of putting individual scripts in ~/bin, so I now wish to version control it. To start out, we have 'csum', a basic column-sum via awk . --- bash/bashrc | 3 +++ bin/csum | 11 +++++++++++ 2 files changed, 14 insertions(+) create mode 100755 bin/csum diff --git a/bash/bashrc b/bash/bashrc index 2dbbc00..e4b4d91 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -22,6 +22,9 @@ PROMPT_COMMAND="echo; history -a" # Other Settings shopt -s checkwinsize # check win size after each cmd, update if needed +# Put ~/bin on the path to facilitate personal customizations +export PATH=$HOME/bin:$PATH + # Custom find function function ff { find . -name "*$1*" diff --git a/bin/csum b/bin/csum new file mode 100755 index 0000000..9834172 --- /dev/null +++ b/bin/csum @@ -0,0 +1,11 @@ +#!/bin/sh +# csum -- sum a column +if [ -z "$1" ]; then + echo "usage: csum N [files]" >&2 + exit 1 +fi + +awk ' +{ s += $'$1' } +END { print s } +' -- libgit2 0.28.4