diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2017-04-05 20:06:39 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2017-04-05 20:46:47 +1200 |
commit | c8ab406749124d2e762ad5cf53963070113afd0f (patch) | |
tree | 54c9721a06957ebe7098a211eea803b0230c0f5d | |
parent | Handle POSIX correctness in ~/.bash_profile (diff) | |
download | dotfiles-c8ab406749124d2e762ad5cf53963070113afd0f.tar.gz dotfiles-c8ab406749124d2e762ad5cf53963070113afd0f.zip |
Apply runtime shebanging to POSIX shell
-rw-r--r-- | .gitignore | 88 | ||||
-rw-r--r-- | Makefile | 110 | ||||
-rw-r--r-- | README.markdown | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/ap.sh (renamed from bin/ap) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/apf.sh (renamed from bin/apf) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/ax.sh (renamed from bin/ax) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/bcq.sh (renamed from bin/bcq) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/bel.sh (renamed from bin/bel) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/bl.sh (renamed from bin/bl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/bp.sh (renamed from bin/bp) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/br.sh (renamed from bin/br) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/ca.sh (renamed from bin/ca) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/cf.sh (renamed from bin/cf) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/cfr.sh (renamed from bin/cfr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/chc.sh (renamed from bin/chc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/chn.sh (renamed from bin/chn) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/clog.sh (renamed from bin/clog) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/clrd.sh (renamed from bin/clrd) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/clwr.sh (renamed from bin/clwr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/d2u.sh (renamed from bin/d2u) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/dmp.sh (renamed from bin/dmp) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/dub.sh (renamed from bin/dub) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/edda.sh (renamed from bin/edda) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/eds.sh (renamed from bin/eds) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/exm.sh (renamed from bin/exm) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/fgscr.sh (renamed from bin/fgscr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/finc.sh (renamed from bin/finc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/fnl.sh (renamed from bin/fnl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/gms.sh (renamed from bin/gms) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/grc.sh (renamed from bin/grc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/gscr.sh (renamed from bin/gscr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/hurl.sh (renamed from bin/hurl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/igex.sh (renamed from bin/igex) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/isgr.sh (renamed from bin/isgr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/ix.sh (renamed from bin/ix) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/jfc.sh (renamed from bin/jfc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/jfcd.sh (renamed from bin/jfcd) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/loc.sh (renamed from bin/loc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/maybe.sh (renamed from bin/maybe) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/mex.sh (renamed from bin/mex) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/mkcp.sh (renamed from bin/mkcp) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/mkmv.sh (renamed from bin/mkmv) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/mktd.sh (renamed from bin/mktd) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/motd.sh (renamed from bin/motd) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/murl.sh (renamed from bin/murl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/osc.sh (renamed from bin/osc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/pa.sh (renamed from bin/pa) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/paz.sh (renamed from bin/paz) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/pit.sh (renamed from bin/pit) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/plmu.sh (renamed from bin/plmu) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/pp.sh (renamed from bin/pp) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/pph.sh (renamed from bin/pph) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/pwg.sh (renamed from bin/pwg) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rfcf.sh (renamed from bin/rfcf) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rfcr.sh (renamed from bin/rfcr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rgl.sh (renamed from bin/rgl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rnda.sh (renamed from bin/rnda) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rndf.sh (renamed from bin/rndf) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rndl.sh (renamed from bin/rndl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/rnds.sh (renamed from bin/rnds) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/shb.sh (renamed from bin/shb) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/slow.sh (renamed from bin/slow) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sls.sh (renamed from bin/sls) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sqs.sh (renamed from bin/sqs) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sra.sh (renamed from bin/sra) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sshi.sh (renamed from bin/sshi) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sta.sh (renamed from bin/sta) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/stbl.sh (renamed from bin/stbl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/stex.sh (renamed from bin/stex) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/stws.sh (renamed from bin/stws) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/sue.sh (renamed from bin/sue) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/supp.sh (renamed from bin/supp) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/swr.sh (renamed from bin/swr) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/td.sh (renamed from bin/td) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/tl.sh (renamed from bin/tl) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/tlcs.sh (renamed from bin/tlcs) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/tm.sh (renamed from bin/tm) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/try.sh (renamed from bin/try) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/u2d.sh (renamed from bin/u2d) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/umake.sh (renamed from bin/umake) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/urlc.sh (renamed from bin/urlc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/urlh.sh (renamed from bin/urlh) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/urlmt.sh (renamed from bin/urlmt) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/vest.sh (renamed from bin/vest) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/vex.sh (renamed from bin/vex) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/wro.sh (renamed from bin/wro) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/xgo.sh (renamed from bin/xgo) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/xgoc.sh (renamed from bin/xgoc) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | bin/xrbg.sh (renamed from bin/xrbg) | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | games/aaf.sh (renamed from games/aaf) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | games/dr.sh (renamed from games/dr) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | games/rndn.sh (renamed from games/rndn) | 0 | ||||
-rw-r--r--[-rwxr-xr-x] | games/xyzzy.sh (renamed from games/xyzzy) | 0 | ||||
-rwxr-xr-x | lint/bin | 11 | ||||
-rwxr-xr-x | lint/games | 11 |
95 files changed, 195 insertions, 116 deletions
@@ -1,31 +1,117 @@ +bin/ap +bin/apf +bin/ax +bin/bcq +bin/bel +bin/bl +bin/bp +bin/br bin/brnl +bin/ca +bin/cf +bin/cfr +bin/chc +bin/chn +bin/clog +bin/clrd +bin/clwr bin/csmw +bin/d2u bin/ddup +bin/dmp +bin/dub +bin/edda +bin/eds +bin/exm +bin/fgscr +bin/finc +bin/fnl +bin/gms +bin/grc +bin/gscr bin/gwp -bin/jfp bin/han bin/hms bin/htdec bin/htenc bin/htref +bin/hurl +bin/igex +bin/isgr +bin/ix +bin/jfc +bin/jfcd +bin/jfp +bin/loc bin/max +bin/maybe bin/mean bin/med +bin/mex bin/mftl bin/min +bin/mkcp +bin/mkmv +bin/mktd bin/mode +bin/motd +bin/murl bin/nlbr bin/onl +bin/osc +bin/pa +bin/paz +bin/pit +bin/plmu +bin/pp +bin/pph +bin/pwg bin/quo +bin/rfcf +bin/rfcr bin/rfct +bin/rgl +bin/rnda +bin/rndf bin/rndi +bin/rndl +bin/rnds bin/sd2u bin/sec +bin/shb +bin/slow +bin/sls bin/slsf +bin/sqs +bin/sra +bin/sshi +bin/sta +bin/stbl +bin/stex +bin/stws bin/su2d +bin/sue +bin/supp +bin/swr +bin/td +bin/tl +bin/tlcs +bin/tm bin/tot +bin/try +bin/u2d +bin/umake bin/unf +bin/urlc +bin/urlh +bin/urlmt bin/uts +bin/vest +bin/vex +bin/wro +bin/xgo +bin/xgoc +bin/xrbg bin/xrq games/acq games/aesth @@ -68,43 +68,133 @@ EMAIL = tom@sanctum.geek.nz KEY = 0xC14286EA77BB8872 SENDMAIL = msmtp -BINS = bin/brnl \ +BINS = bin/ap \ + bin/apf \ + bin/ax \ + bin/bcq \ + bin/bel \ + bin/bl \ + bin/bp \ + bin/br \ + bin/brnl \ + bin/ca \ + bin/cf \ + bin/cfr \ + bin/chc \ + bin/chn \ + bin/clog \ + bin/clrd \ + bin/clwr \ bin/csmw \ + bin/d2u \ bin/ddup \ + bin/dmp \ + bin/dub \ + bin/edda \ + bin/eds \ + bin/exm \ + bin/fgscr \ + bin/finc \ + bin/fnl \ + bin/gms \ + bin/grc \ + bin/gscr \ bin/gwp \ bin/han \ bin/hms \ bin/htdec \ bin/htenc \ bin/htref \ + bin/hurl \ + bin/igex \ + bin/isgr \ + bin/ix \ + bin/jfc \ + bin/jfcd \ bin/jfp \ + bin/loc \ bin/max \ + bin/maybe \ bin/mean \ bin/med \ + bin/mex \ bin/mftl \ bin/min \ + bin/mkcp \ + bin/mkmv \ + bin/mktd \ bin/mode \ + bin/motd \ + bin/murl \ bin/nlbr \ bin/onl \ + bin/osc \ + bin/pa \ + bin/paz \ + bin/pit \ + bin/plmu \ + bin/pp \ + bin/pph \ + bin/pwg \ bin/quo \ + bin/rfcf \ + bin/rfcr \ bin/rfct \ + bin/rgl \ + bin/rnda \ + bin/rndf \ bin/rndi \ + bin/rndl \ + bin/rnds \ bin/sd2u \ bin/sec \ + bin/shb \ + bin/slow \ + bin/sls \ bin/slsf \ + bin/sqs \ + bin/sra \ + bin/sshi \ + bin/sta \ + bin/stbl \ + bin/stex \ + bin/stws \ bin/su2d \ + bin/sue \ + bin/supp \ + bin/swr \ + bin/td \ + bin/tl \ + bin/tlcs \ + bin/tm \ bin/tot \ + bin/try \ + bin/u2d \ + bin/umake \ bin/unf \ + bin/urlc \ + bin/urlh \ + bin/urlmt \ bin/uts \ + bin/vest \ + bin/vex \ + bin/wro \ + bin/xgo \ + bin/xgoc \ + bin/xrbg \ bin/xrq -GAMES = games/acq \ +GAMES = games/aaf \ + games/acq \ games/aesth \ games/chkl \ + games/dr \ games/drakon \ games/kvlt \ + games/rndn \ games/rot13 \ games/strik \ + games/xyzzy \ games/zs all: $(BINS) git/gitconfig gnupg/gpg.conf @@ -147,19 +237,23 @@ tmux/tmux.conf: tmux/tmux.conf.m4 tmux/tmux.conf.m4 > $@ .awk: - bin/shb awk -f < $< > $@ + sh bin/shb.sh awk -f < $< > $@ chmod +x ./$@ .bash: - bin/shb bash < $< > $@ + sh bin/shb.sh bash < $< > $@ chmod +x ./$@ .pl: - bin/shb perl < $< > $@ + sh bin/shb.sh perl < $< > $@ chmod +x ./$@ .sed: - bin/shb sed -f < $< > $@ + sh bin/shb.sh sed -f < $< > $@ + chmod +x ./$@ + +.sh: + sh bin/shb.sh sh < $< > $@ chmod +x ./$@ install: install-bash \ @@ -403,10 +497,10 @@ lint: check \ lint-bash: lint/bash -lint-bin: $(BINS) +lint-bin: lint/bin -lint-games: $(GAMES) +lint-games: lint/games lint-ksh: diff --git a/README.markdown b/README.markdown index 43dddf0c..8fd19dff 100644 --- a/README.markdown +++ b/README.markdown @@ -15,7 +15,10 @@ Installation $ make -n install $ make install -For the default `all` target, you'll need `bash(1)`, `make(1)`, and `m4(1)`. +For the default `all` target, you'll need `make(1)`, `m4(1)`, and a +POSIX-fearing `sh(1)`. If you're on a system where `/bin/sh` is not a POSIX +shell, you may need to check you have e.g. `/usr/xpg4/bin` at the front of your +`$PATH` at build time. The installation `Makefile` will overwrite things standing in the way of its installed files without backing them up, so read the output of `make -n @@ -1,4 +1,3 @@ -#!/bin/sh # Run a program with args read from standard input, prompted if from term if [ "$#" -eq 0 ] ; then printf >&2 'ap: Need at least one argument (command name)\n' diff --git a/bin/apf b/bin/apf.sh index 39bc0720..5e40e9b8 100755..100644 --- a/bin/apf +++ b/bin/apf.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Prepend arguments from a file to the given arguments for a command self=apf @@ -1,4 +1,3 @@ -#!/bin/sh # Evaluate an Awk expression given on the command line with an optional format # Count arguments diff --git a/bin/bcq b/bin/bcq.sh index 7b950b56..71a79666 100755..100644 --- a/bin/bcq +++ b/bin/bcq.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Fire up bc(1), hushing it if it looks like GNU [ -e "$HOME"/.cache/bc/quiet ] && set -- --quiet "$@" exec bc "$@" diff --git a/bin/bel b/bin/bel.sh index c1c2ce1c..e87eceda 100755..100644 --- a/bin/bel +++ b/bin/bel.sh @@ -1,3 +1,2 @@ -#!/bin/sh # Print a terminal bell printf '\a' @@ -1,4 +1,3 @@ -#!/bin/sh # Generate blank lines if [ "$#" -ne 1 ] || [ "$1" -lt 0 ] ; then printf >&2 'bl: Non-negative line count needed as sole argument\n' @@ -1,3 +1,2 @@ -#!/bin/sh # Read an URL and then browse to it, saving the annoyance of quoting URLs ap br URL @@ -1,3 +1,2 @@ -#!/bin/sh # Just launch $BROWSER with any given arguments exec "$BROWSER" "$@" @@ -1,3 +1,2 @@ -#!/bin/sh # Print a count of the number of arguments printf '%u\n' "$#" @@ -1,4 +1,3 @@ -#!/bin/sh # Count entries in a given set of directories # Iterate over remaining non-option arguments (directories); default to current diff --git a/bin/cfr b/bin/cfr.sh index d49ab3d9..9d13785c 100755..100644 --- a/bin/cfr +++ b/bin/cfr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Count entries in a given set of directories # Iterate over remaining non-option arguments (directories); default to current diff --git a/bin/chc b/bin/chc.sh index b1e4000d..8b15317c 100755..100644 --- a/bin/chc +++ b/bin/chc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Cache the output of a command and emit it straight from the cache if not # expired on each run diff --git a/bin/chn b/bin/chn.sh index 46a8a27a..9103dd07 100755..100644 --- a/bin/chn +++ b/bin/chn.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Repeat a command to filter input several times self=chn diff --git a/bin/clog b/bin/clog.sh index 037f24c7..0964ce90 100755..100644 --- a/bin/clog +++ b/bin/clog.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Record a timestamped message to a logfile, defaulting to ~/.clog self=clog command -v rlwrap >/dev/null 2>&1 && diff --git a/bin/clrd b/bin/clrd.sh index 0b460671..bf239033 100755..100644 --- a/bin/clrd +++ b/bin/clrd.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Clear the screen and read a file as it's written line-by-line self=clrd diff --git a/bin/clwr b/bin/clwr.sh index dc045e9d..897c1a01 100755..100644 --- a/bin/clwr +++ b/bin/clwr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Write lines of terminal input into a file, clearing in between each one self=clwr diff --git a/bin/d2u b/bin/d2u.sh index 6fe362b7..22c8e16b 100755..100644 --- a/bin/d2u +++ b/bin/d2u.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Convert DOS line endings to UNIX ones # Check arguments diff --git a/bin/dmp b/bin/dmp.sh index 4299771d..ea79214f 100755..100644 --- a/bin/dmp +++ b/bin/dmp.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Get the password store directory, bail if we can't pwsd=${PASSWORD_STORE_DIR:-"$HOME"/.password-store} diff --git a/bin/dub b/bin/dub.sh index 36d787a4..f42c5ac9 100755..100644 --- a/bin/dub +++ b/bin/dub.sh @@ -1,4 +1,3 @@ -#!/bin/sh # List the biggest files in a directory # First optional argument is the directory, defaulting to the diff --git a/bin/edda b/bin/edda.sh index 6af88a5f..b1d7b27a 100755..100644 --- a/bin/edda +++ b/bin/edda.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run ed(1) over multiple files, duplicating stdin. self=edda diff --git a/bin/eds b/bin/eds.sh index e39215d4..c85069c6 100755..100644 --- a/bin/eds +++ b/bin/eds.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Create and edit executable scripts in a directory EDSPATH (defaults to ~/.local/bin) # Need at least one script name diff --git a/bin/exm b/bin/exm.sh index f1afa17a..25e3006f 100755..100644 --- a/bin/exm +++ b/bin/exm.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Prevent Vim's ex(1) implementation from clearing the screen if [ -t 0 ] ; then ver=$(ex --version 2>/dev/null | awk 'NR==1{print $1;exit}') diff --git a/bin/fgscr b/bin/fgscr.sh index 7d5ff4c5..137e0dd8 100755..100644 --- a/bin/fgscr +++ b/bin/fgscr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Find all the Git repositories in a directory and scrub them all # Check we have gscr(1df) first diff --git a/bin/finc b/bin/finc.sh index 109f02b3..2bbb9ae8 100755..100644 --- a/bin/finc +++ b/bin/finc.sh @@ -1,3 +1,2 @@ -#!/bin/sh # Count the number of entries from a find(1) condition find "${@:-.}" -exec printf .%sx {} + | wc -c diff --git a/bin/fnl b/bin/fnl.sh index 6969665b..8d771adb 100755..100644 --- a/bin/fnl +++ b/bin/fnl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run a command and save its output and error to temporary files # Check we have at least one argument diff --git a/bin/gms b/bin/gms.sh index 01cdaa2f..b77da6fa 100755..100644 --- a/bin/gms +++ b/bin/gms.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run getmail(1) over every getmailrc.* file in ~/.getmail # Trap to remove whatever's set in lockdir if we're killed diff --git a/bin/grc b/bin/grc.sh index 0db91afa..184baf8e 100755..100644 --- a/bin/grc +++ b/bin/grc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Check whether a directory is a Git repository with uncommitted changes # Enter given directory or bail diff --git a/bin/gscr b/bin/gscr.sh index cac969fe..2fbee05a 100755..100644 --- a/bin/gscr +++ b/bin/gscr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Scrub and pack Git repositories # Iterate through given directories; default to the current one diff --git a/bin/hurl b/bin/hurl.sh index 16ea48f8..0680c5ce 100755..100644 --- a/bin/hurl +++ b/bin/hurl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Extract <a href="..."> URLs from an HTML document or documents # Input is either stdin or the given arguments concatenated diff --git a/bin/igex b/bin/igex.sh index c514006d..09f1206f 100755..100644 --- a/bin/igex +++ b/bin/igex.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run a command and ignore specified exit values # There should be at least two arguments diff --git a/bin/isgr b/bin/isgr.sh index 029b5352..9d3e97a8 100755..100644 --- a/bin/isgr +++ b/bin/isgr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Return an exit status for whether the current directory appears to be in a # Git working copy @@ -1,4 +1,3 @@ -#!/bin/sh # Convenience script for posting to ix.io pastebin cat -- "${@:--}" | curl -F 'f:1=<-' http://ix.io/ diff --git a/bin/jfc b/bin/jfc.sh index 33d0fe5d..3d155aca 100755..100644 --- a/bin/jfc +++ b/bin/jfc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Commit all changes to a Git repository with a stock message message # Enter the given directory, default to the current one diff --git a/bin/jfcd b/bin/jfcd.sh index 8bd54e3b..bf059883 100755..100644 --- a/bin/jfcd +++ b/bin/jfcd.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Watch a directory for changes and commit them with jfc(1d) if there are any; # requires inotifywait(1) diff --git a/bin/loc b/bin/loc.sh index d92dc886..995c6932 100755..100644 --- a/bin/loc +++ b/bin/loc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Convenience find(1) wrapper for path substrings # Require at least one search term diff --git a/bin/maybe b/bin/maybe.sh index a2de17dd..6e5c8658 100755..100644 --- a/bin/maybe +++ b/bin/maybe.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Exit with success or failure with a given probability self=maybe diff --git a/bin/mex b/bin/mex.sh index 005149d8..0b3d6c7e 100755..100644 --- a/bin/mex +++ b/bin/mex.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Make the first non-executable instance of files with the given names in $PATH # executable self=mex diff --git a/bin/mkcp b/bin/mkcp.sh index 37bc87c0..10308263 100755..100644 --- a/bin/mkcp +++ b/bin/mkcp.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Copy files into created directory in one call # Check we have at least two arguments diff --git a/bin/mkmv b/bin/mkmv.sh index 803ef05c..53b5aa8f 100755..100644 --- a/bin/mkmv +++ b/bin/mkmv.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Move files into created directory in one call # Check we have at least two arguments diff --git a/bin/mktd b/bin/mktd.sh index 75bbb4b3..62b10396 100755..100644 --- a/bin/mktd +++ b/bin/mktd.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Try to make a random temp directory # Get a random seed from rnds(1df); if it's empty, that's still workable diff --git a/bin/motd b/bin/motd.sh index ee60ad03..4ac88081 100755..100644 --- a/bin/motd +++ b/bin/motd.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Show the system MOTD motd=${MOTD:-/etc/motd} [ -f "$motd" ] || exit diff --git a/bin/murl b/bin/murl.sh index 95db92c9..91304aa1 100755..100644 --- a/bin/murl +++ b/bin/murl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Format markdown and pass it to hurl to extract URLs from it. # Pipe the output of pandoc(1) on our args into hurl(1df) diff --git a/bin/osc b/bin/osc.sh index 87f79365..ba35d9b7 100755..100644 --- a/bin/osc +++ b/bin/osc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Sane and safe OpenSSL s_client(1ssl) connection self=osc @@ -1,4 +1,3 @@ -#!/bin/sh # Print arguments, one per line. Compare paz(1df). [ "$#" -gt 0 ] || exit 0 printf '%s\n' "$@" diff --git a/bin/paz b/bin/paz.sh index b1f09ca9..e9b81bd7 100755..100644 --- a/bin/paz +++ b/bin/paz.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Print arguments, terminated by null chars. Compare pa(1df). [ "$#" -gt 0 ] || exit 0 printf '%s\0' "$@" diff --git a/bin/pit b/bin/pit.sh index d3068e76..377c1927 100755..100644 --- a/bin/pit +++ b/bin/pit.sh @@ -1,4 +1,3 @@ -#!/bin/sh # If no arguments, we'll use stdin if [ "$#" -eq 0 ] ; then diff --git a/bin/plmu b/bin/plmu.sh index cf9b7eae..d6f163e6 100755..100644 --- a/bin/plmu +++ b/bin/plmu.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Set up exceptions file if it exists ef=$HOME/.plenv/non-cpanm-modules @@ -1,4 +1,3 @@ -#!/bin/sh # Print the full path to each argument; path need not exist for arg ; do case $arg in diff --git a/bin/pph b/bin/pph.sh index 7987382f..268b6ad7 100755..100644 --- a/bin/pph +++ b/bin/pph.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run pp(1df) on args, prefix with machine hostname hn=$(hostname -s) || exit pp "$@" | diff --git a/bin/pwg b/bin/pwg.sh index 97af3df4..e73ae97a 100755..100644 --- a/bin/pwg +++ b/bin/pwg.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Shortcut to generate just one strong password with pwgen(1) # If any arguments are provided, those are used instead if [ "$#" -eq 0 ] ; then diff --git a/bin/rfcf b/bin/rfcf.sh index 6f257415..36b1a4c4 100755..100644 --- a/bin/rfcf +++ b/bin/rfcf.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Check arguments if [ "$#" -ne 1 ] ; then diff --git a/bin/rfcr b/bin/rfcr.sh index 75d9abb0..860ae53d 100755..100644 --- a/bin/rfcr +++ b/bin/rfcr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Check arguments if [ "$#" -ne 1 ] ; then diff --git a/bin/rgl b/bin/rgl.sh index a06ecd0a..630d38b6 100755..100644 --- a/bin/rgl +++ b/bin/rgl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Read grep(1) patterns from input and search for them in the given files self=rgl diff --git a/bin/rnda b/bin/rnda.sh index 5af4a3bd..b09a8b6f 100755..100644 --- a/bin/rnda +++ b/bin/rnda.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Choose a random argument using rndi(1df) # Check we have at least one argument diff --git a/bin/rndf b/bin/rndf.sh index 67f9d997..21aa76a6 100755..100644 --- a/bin/rndf +++ b/bin/rndf.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Choose a random file from a given directory using rnda(1df); ignores dot # files diff --git a/bin/rndl b/bin/rndl.sh index c09c2c78..18bcec07 100755..100644 --- a/bin/rndl +++ b/bin/rndl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Print a random line from input self=rndl diff --git a/bin/rnds b/bin/rnds.sh index c5ffabe4..6b3ac904 100755..100644 --- a/bin/rnds +++ b/bin/rnds.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Try to get a low-quality random seed from a random device if possible # Sole optional argument is the bytes to read; 32 is the default diff --git a/bin/shb b/bin/shb.sh index 72ac818b..7d31876d 100755..100644 --- a/bin/shb +++ b/bin/shb.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Use PATH to build a shebang for a script given on stdin self=shb diff --git a/bin/slow b/bin/slow.sh index a7bdae76..b0047829 100755..100644 --- a/bin/slow +++ b/bin/slow.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Convert uppercase letters in a stream to lowercase cat "${@:--}" | tr '[:upper:]' '[:lower:]' diff --git a/bin/sls b/bin/sls.sh index 770b8ec0..55c1dfc7 100755..100644 --- a/bin/sls +++ b/bin/sls.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Print hostnames from ssh_config(5) files, defaulting to the usual paths # If we weren't given a file explicitly, we'll try to read both /etc/ssh_config diff --git a/bin/sqs b/bin/sqs.sh index d0b3023f..e00797e3 100755..100644 --- a/bin/sqs +++ b/bin/sqs.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Chop a trailing query string off filenames self=sqs diff --git a/bin/sra b/bin/sra.sh index 7f072dfb..f3ed6f71 100755..100644 --- a/bin/sra +++ b/bin/sra.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run ssh(1) with an optional command on every host in sls(1df) output # Use FD3 to keep a reference to the script's stdin for the ssh(1) calls exec 3<&0 diff --git a/bin/sshi b/bin/sshi.sh index 80e00a10..0d1591f1 100755..100644 --- a/bin/sshi +++ b/bin/sshi.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Print some human-readable information from SSH_CONNECTION # Check we have an SSH_CONNECTION variable diff --git a/bin/sta b/bin/sta.sh index 848d9740..5736842a 100755..100644 --- a/bin/sta +++ b/bin/sta.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Print list of sls(1df) hostnames that exit 0 when a connection is attempted # and the optional given command is run. Discard stdout, but preserve stderr. sls | while read -r hostname ; do diff --git a/bin/stbl b/bin/stbl.sh index 34a06251..23d77703 100755..100644 --- a/bin/stbl +++ b/bin/stbl.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Strip a trailing blank line from the given files with ed(1) # Check arguments diff --git a/bin/stex b/bin/stex.sh index f1f9c029..14d2cabf 100755..100644 --- a/bin/stex +++ b/bin/stex.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Strip an extension from the given filenames self=stex diff --git a/bin/stws b/bin/stws.sh index 2ceae935..ce2c14d0 100755..100644 --- a/bin/stws +++ b/bin/stws.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Strip trailing spaces on one or more files # Check arguments diff --git a/bin/sue b/bin/sue.sh index 64d566f7..654c041f 100755..100644 --- a/bin/sue +++ b/bin/sue.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run sudoedit(8) with an appropriate user on a set of files # Blank out the user variable diff --git a/bin/supp b/bin/supp.sh index 1ba6c850..5ddbadc3 100755..100644 --- a/bin/supp +++ b/bin/supp.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Convert lowercase letters in a stream to uppercase cat "${@:--}" | tr '[:lower:]' '[:upper:]' diff --git a/bin/swr b/bin/swr.sh index 56ab5919..47c84b86 100755..100644 --- a/bin/swr +++ b/bin/swr.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Transparently wrap scp(1) targets on the command line self=swr @@ -1,4 +1,3 @@ -#!/bin/sh # Manage to-do files with just $EDITOR and git(1) # Specify the path and file @@ -1,4 +1,3 @@ -#!/bin/sh # Tag lines from files or stdin with a string prefix or suffix self=tl diff --git a/bin/tlcs b/bin/tlcs.sh index aa0d2f25..f20b160e 100755..100644 --- a/bin/tlcs +++ b/bin/tlcs.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Execute a command and tag the output of the stdout and stderr streams. self=tlcs @@ -1,4 +1,3 @@ -#!/bin/sh # Attach to existing tmux session rather than create a new one if possible # If given any arguments, just use them as they are diff --git a/bin/try b/bin/try.sh index 7d6d57a8..20ccbe5f 100755..100644 --- a/bin/try +++ b/bin/try.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Attempt a certain number of times to perform a task, buffer stderr unless and # until all command attempts fail self=try diff --git a/bin/u2d b/bin/u2d.sh index 505b3d04..9f4e800a 100755..100644 --- a/bin/u2d +++ b/bin/u2d.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Convert UNIX line endings to DOS ones # Check arguments diff --git a/bin/umake b/bin/umake.sh index e8de7ae6..21073328 100755..100644 --- a/bin/umake +++ b/bin/umake.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Keep going up the tree until we find a Makefile, and then run make(1) with # any given args while [ "$PWD" != / ] ; do diff --git a/bin/urlc b/bin/urlc.sh index a949f50d..0e6530fa 100755..100644 --- a/bin/urlc +++ b/bin/urlc.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Try to find erroneous or insecure URLs self=urlc diff --git a/bin/urlh b/bin/urlh.sh index 8e9463e7..5b5cab74 100755..100644 --- a/bin/urlh +++ b/bin/urlh.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Get values for HTTP headers for the given URL # Check arguments diff --git a/bin/urlmt b/bin/urlmt.sh index b209f26a..cd71b0fd 100755..100644 --- a/bin/urlmt +++ b/bin/urlmt.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Get the MIME type for a given URL urlh "$1" Content-Type | diff --git a/bin/vest b/bin/vest.sh index f857d8c1..7dd65f0b 100755..100644 --- a/bin/vest +++ b/bin/vest.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run a test(1) command and print a string to stdout showing pass/fail if [ "$#" -eq 0 ] ; then printf >&2 'vest: Need test(1) arguments\n' diff --git a/bin/vex b/bin/vex.sh index 908288ba..8a696577 100755..100644 --- a/bin/vex +++ b/bin/vex.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Run a command and print a string to stdout showing pass/fail if [ "$#" -eq 0 ] ; then printf >&2 'vex: Need a command\n' diff --git a/bin/wro b/bin/wro.sh index 4c465adb..3888c526 100755..100644 --- a/bin/wro +++ b/bin/wro.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Add an email-style quote header to input self=wro diff --git a/bin/xgo b/bin/xgo.sh index 652d5a14..4d7cf922 100755..100644 --- a/bin/xgo +++ b/bin/xgo.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Test and open a clipboard URL with an apt program # Check arguments diff --git a/bin/xgoc b/bin/xgoc.sh index 516f7028..42e04e2d 100755..100644 --- a/bin/xgoc +++ b/bin/xgoc.sh @@ -1,3 +1,2 @@ -#!/bin/sh # Run xgo(1df) with the contents of the X clipboard xgo "$(xsel)" diff --git a/bin/xrbg b/bin/xrbg.sh index 801bf078..617a9b43 100755..100644 --- a/bin/xrbg +++ b/bin/xrbg.sh @@ -1,4 +1,3 @@ -#!/bin/sh # Apply a random background image. Requires rndf(1df) and feh(1). bg=$(rndf "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}") || exit feh --bg-scale --no-fehbg -- "$bg" diff --git a/games/aaf b/games/aaf.sh index 4f1825c6..4f1825c6 100755..100644 --- a/games/aaf +++ b/games/aaf.sh diff --git a/games/dr b/games/dr.sh index e1db163d..e1db163d 100755..100644 --- a/games/dr +++ b/games/dr.sh diff --git a/games/rndn b/games/rndn.sh index 18c34218..18c34218 100755..100644 --- a/games/rndn +++ b/games/rndn.sh diff --git a/games/xyzzy b/games/xyzzy.sh index d262c0e6..d262c0e6 100755..100644 --- a/games/xyzzy +++ b/games/xyzzy.sh @@ -1,11 +1,2 @@ #!/bin/sh -for bin in bin/* ; do - [ -f "$bin" ] || continue - hb=$(sed 1q "$bin") || exit - case $hb in - *sh) - printf '%s\n' "$bin" - shellcheck -- "$bin" - ;; - esac -done +find bin -type f -name '*.sh' -print -exec shellcheck -e SC1090 -s sh -- {} + @@ -1,11 +1,2 @@ #!/bin/sh -for game in games/* ; do - [ -f "$game" ] || continue - hb=$(sed 1q "$game") || exit - case $hb in - *sh) - printf '%s\n' "$game" - shellcheck -- "$game" - ;; - esac -done +find games -type f -name '*.sh' -print -exec shellcheck -e SC1090 -s sh -- {} + |