aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/ax.sh2
-rw-r--r--bin/chn.mi52
-rw-r--r--bin/dub.sh6
-rw-r--r--bin/eds.sh3
-rw-r--r--bin/gwp.awk3
-rw-r--r--bin/han.bash10
-rw-r--r--bin/mi5.awk8
-rw-r--r--bin/pa.sh2
-rw-r--r--bin/paz.sh2
-rw-r--r--bin/rep.sh4
-rw-r--r--bin/rndi.awk2
-rw-r--r--bin/sta.sh2
-rw-r--r--bin/tlcs.mi54
-rw-r--r--bin/xgo.sh12
-rw-r--r--bin/xrbg.sh2
15 files changed, 33 insertions, 31 deletions
diff --git a/bin/ax.sh b/bin/ax.sh
index 0007cbed..50b839cf 100644
--- a/bin/ax.sh
+++ b/bin/ax.sh
@@ -18,5 +18,5 @@ esac
# Important note: there's little stopping the user from putting a fully-fledged
# Awk program into the expression; don't use this anywhere that code injection
-# could wreck your life. See manual page ax(1df).
+# could wreck your life. See manual page ax(1df).
awk -v form="$form" 'BEGIN{printf form,('"$expr"');exit}'
diff --git a/bin/chn.mi5 b/bin/chn.mi5
index dfc1000c..28178ac0 100644
--- a/bin/chn.mi5
+++ b/bin/chn.mi5
@@ -11,7 +11,7 @@ fi
c=$1
shift
-# Check the repetition count looks sane. Zero is fine!
+# Check the repetition count looks sane. Zero is fine!
if [ "$c" -lt 0 ] ; then
printf >&2 '%s: Nonsensical negative count\n' "$self"
exit 2
diff --git a/bin/dub.sh b/bin/dub.sh
index efdae4e9..7556241f 100644
--- a/bin/dub.sh
+++ b/bin/dub.sh
@@ -9,9 +9,9 @@ dir=${1:-.} lim=${2:-10}
# Enter the target dir or bail
cd -- "$dir" || exit
-# Some find(1) devilry to deal with newlines as safely as possible. The idea is
-# not even to touch them, and warn about their presence; better the results are
-# wrong than malformed
+# Some find(1) devilry to deal with newlines as safely as possible. The idea
+# is not even to touch them, and warn about their presence; better the results
+# are wrong than malformed
nl=$(printf '\n/')
find . ! -name . -prune \( \
-name '*'"${nl%/}"'*' \
diff --git a/bin/eds.sh b/bin/eds.sh
index c692cb30..7e719e9d 100644
--- a/bin/eds.sh
+++ b/bin/eds.sh
@@ -1,4 +1,5 @@
-# Create and edit executable scripts in a directory EDSPATH (defaults to ~/.local/bin)
+# Create and edit executable scripts in a directory EDSPATH (defaults to
+# ~/.local/bin)
# Need at least one script name
if [ "$#" -eq 0 ] ; then
diff --git a/bin/gwp.awk b/bin/gwp.awk
index 60013add..fcfa5eab 100644
--- a/bin/gwp.awk
+++ b/bin/gwp.awk
@@ -14,7 +14,8 @@ BEGIN {
# match case-insensitively
word = tolower(ARGV[1])
- # Blank the first argument so Awk doesn't try to read data from it as a file
+ # Blank the first argument so Awk doesn't try to read data from it as a
+ # file
ARGV[1] = ""
# Bail out if we don't have a suitable word
diff --git a/bin/han.bash b/bin/han.bash
index 3c4f6637..6ab0b3e7 100644
--- a/bin/han.bash
+++ b/bin/han.bash
@@ -1,14 +1,10 @@
# Abstract calls to Bash help vs man(1)
self=han
-# Ensure we're using at least version 2.05. Weird arithmetic syntax needed here
-# due to leading zeroes and trailing letters in some 2.x version numbers (e.g.
-# 2.05a).
+# Ensure we're using at least version 3.0
# shellcheck disable=SC2128
-[ -n "$BASH_VERSINFO" ] || exit
-((BASH_VERSINFO[0] == 2)) &&
- ((10#${BASH_VERSINFO[1]%%[![:digit:]]*} < 5)) &&
- exit
+[ -n "$BASH_VERSINFO" ] || exit # Check version array exists (>=2.0)
+((BASH_VERSINFO[0] >= 3)) || exit # Check actual major version number
# Figure out the options with which we can call help; Bash >=4.0 has an -m
# option which prints the help output in a man-page like format
diff --git a/bin/mi5.awk b/bin/mi5.awk
index 7acb6f3b..0a00d1d7 100644
--- a/bin/mi5.awk
+++ b/bin/mi5.awk
@@ -55,8 +55,8 @@ bmac && NF {
# Start off neither quoting nor macroing.
iquo = imac = 0
- # Crude and slow, clansman. Your parser was no better than that of a clumsy
- # child.
+ # Crude and slow, clansman. Your parser was no better than that of a
+ # clumsy child.
for (i = 1; i <= length(src); ) {
# Inline macro expansion: commented
@@ -100,8 +100,8 @@ bmac && NF {
# Escape quote terminators
if (substr(src, i, length(unquote)) == unquote) {
- # Dear Mr. President. There are too many variables nowadays.
- # Please eliminate three. I am NOT a crackpot.
+ # Dear Mr. President. There are too many variables nowadays.
+ # Please eliminate three. I am NOT a crackpot.
dst = dst unquote unquote quote
i += length(unquote)
diff --git a/bin/pa.sh b/bin/pa.sh
index 4cfa9dce..7e3e14f8 100644
--- a/bin/pa.sh
+++ b/bin/pa.sh
@@ -1,3 +1,3 @@
-# Print arguments, one per line. Compare paz(1df).
+# Print arguments, one per line. Compare paz(1df).
[ "$#" -gt 0 ] || exit 0
printf '%s\n' "$@"
diff --git a/bin/paz.sh b/bin/paz.sh
index e9b81bd7..32d2355f 100644
--- a/bin/paz.sh
+++ b/bin/paz.sh
@@ -1,3 +1,3 @@
-# Print arguments, terminated by null chars. Compare pa(1df).
+# Print arguments, terminated by null chars. Compare pa(1df).
[ "$#" -gt 0 ] || exit 0
printf '%s\0' "$@"
diff --git a/bin/rep.sh b/bin/rep.sh
index e53cbac3..522187b6 100644
--- a/bin/rep.sh
+++ b/bin/rep.sh
@@ -11,13 +11,13 @@ fi
c=$1
shift
-# Check the repetition count looks sane. Zero is fine!
+# Check the repetition count looks sane. Zero is fine!
if [ "$c" -lt 0 ] ; then
printf >&2 '%s: Nonsensical negative count\n' "$self"
exit 2
fi
-# Run the command the specified number of times. Stop immediately as soon as a
+# Run the command the specified number of times. Stop immediately as soon as a
# run fails.
while [ "${n=1}" -le "$c" ] ; do
"$@" || exit
diff --git a/bin/rndi.awk b/bin/rndi.awk
index 02e0574f..7d9c640b 100644
--- a/bin/rndi.awk
+++ b/bin/rndi.awk
@@ -1,4 +1,4 @@
-# Get a low-quality random number between two integers. Depending on the awk
+# Get a low-quality random number between two integers. Depending on the awk
# implementation, if you don't have rnds(1df) available to generate a seed of
# sufficient quality, you might get very predictable random numbers based on
# the current epoch second.
diff --git a/bin/sta.sh b/bin/sta.sh
index 5736842a..a32e87f6 100644
--- a/bin/sta.sh
+++ b/bin/sta.sh
@@ -1,5 +1,5 @@
# 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.
+# and the optional given command is run. Discard stdout, but preserve stderr.
sls | while read -r hostname ; do
# shellcheck disable=SC2029
ssh -nq -- "$hostname" "$@" >/dev/null || continue
diff --git a/bin/tlcs.mi5 b/bin/tlcs.mi5
index a3e17c82..519a41f8 100644
--- a/bin/tlcs.mi5
+++ b/bin/tlcs.mi5
@@ -71,8 +71,8 @@ fi
include(`include/mktd.m4')
%>
-# Execute the command, passing stdout and stderr to tl(1df) calls as appropriate
-# via named pipes
+# Execute the command, passing stdout and stderr to tl(1df) calls as
+# appropriate via named pipes
out=$td/out err=$td/err
mkfifo -- "$out" "$err" || exit
tl -p "$out_pref" -s "$out_suff" < "$out" &
diff --git a/bin/xgo.sh b/bin/xgo.sh
index e627f9c6..1b9f83da 100644
--- a/bin/xgo.sh
+++ b/bin/xgo.sh
@@ -12,7 +12,8 @@ for url do (
# Look for patterns in the URL that suggest transformations
case $url in
- # If this is a GitHub or GitLab link, swap "blob" for "raw" to get the actual file
+ # If this is a GitHub or GitLab link, swap "blob" for "raw" to get the
+ # actual file
(*://github.com/*/blob/*|*://gitlab.com/*/blob/*)
url=$(printf '%s\n' "$url" | sed 's_/blob/_/raw/_')
;;
@@ -20,7 +21,8 @@ for url do (
# Dig out the plain text for pastebin.com links
(*://pastebin.com/*)
# shellcheck disable=SC2016
- url=$(printf '%s\n' "$url" | sed 's_/[A-Za-z0-9][A-Za-z0-9]*$_/raw&_')
+ url=$(printf '%s\n' "$url" |
+ sed 's_/[A-Za-z0-9][A-Za-z0-9]*$_/raw&_')
;;
# If this is a not-direct imgur link and not to an album, swap URL
@@ -28,10 +30,12 @@ for url do (
# the MIME type will tell us)
(*://imgur.com/a/*) ;;
(*://imgur.com/*)
- url=$(printf '%s\n' "$url" | sed 's_imgur\.com_i.imgur.com_;s/$/.jpg/')
+ url=$(printf '%s\n' "$url" |
+ sed 's_imgur\.com_i.imgur.com_;s/$/.jpg/')
;;
- # If this is a YouTube video without a given start time, load it in mpv(1)
+ # If this is a YouTube video without a given start time, load it in
+ # mpv(1)
(*[/.]youtube.com/watch*[?\&]t=) ;;
(*[/.]youtube.com/watch*)
mpv -- "$url" && exit
diff --git a/bin/xrbg.sh b/bin/xrbg.sh
index 617a9b43..0c7262c0 100644
--- a/bin/xrbg.sh
+++ b/bin/xrbg.sh
@@ -1,3 +1,3 @@
-# Apply a random background image. Requires rndf(1df) and feh(1).
+# Apply a random background image. Requires rndf(1df) and feh(1).
bg=$(rndf "${XBACKGROUNDS:-"$HOME"/.xbackgrounds}") || exit
feh --bg-scale --no-fehbg -- "$bg"