M README.md => README.md +3 -3
@@ 16,9 16,9 @@ epub |Dumps HTML from an 'epub' e-book archive |`bash`
fw-status |Print current firewall status |`ufw`
mkbak |Create a backup of a target file |`bash`
mktar |Wrapper around `tar` for easier compression |`bash` *
-pingable |Check if an address/name is ping-able
+pingable |Check if an address/name is ping-able |`ping`
rand |Get a random number within an inclusive range |`bash`, `shuf`
-rebom |Add BOM to a target file |
+rebom |Add BOM to a target file
rmtar |Delete 'tar' archive files
rmzip |Delete 'zip' archive files
start-at |After a pattern is matched, re-print |GNU or New (AT&T) `awk`
@@ 41,7 41,7 @@ zipls |List files within `zip` archive file(s) |`zipin
Executable |Description |Extra Dependencies
:----------------|:------------------------------------------------------|:-----------------
-android-emulator |Start an Android emulator session |`adb`
+android-emulator |Start an Android emulator session |`adb`, `emulator`
qemu-test |Check if hardware and OS are capable of virtualization |
M src/enumerate => src/enumerate +2 -2
@@ 107,7 107,7 @@ code=0
find . -maxdepth 1 -name "$filter" -type f -printf "%f\0" \
| sort -z \
| while IFS= read -r -d '' original_fn; do
- wide_n=$(printf "%0*d\n" "$width" "$n")
+ wide_n=$(/usr/bin/printf "%0*d\n" "$width" "$n")
enum_fn="${wide_n}.$(fn_extension "$original_fn")"
debug_msg "Widened format of '${n}' is '${wide_n}'"
debug_msg "Input filename is '${original_fn}'"
@@ 117,7 117,7 @@ find . -maxdepth 1 -name "$filter" -type f -printf "%f\0" \
code=1
fi
else
- printf "#mv %s %s\n" "$original_fn" "$enum_fn"
+ /usr/bin/printf "#mv %s %s\n" "$original_fn" "$enum_fn"
fi
n=$((n+s))
done
M src/mktar => src/mktar +1 -1
@@ 60,7 60,7 @@ while [[ $# -gt 0 ]]; do
;;
--compress=*)
- attempted_compression="$(printf "%s\n" "$1" | sed -e 's/^.*=//' )"
+ attempted_compression="$(/usr/bin/printf "%s\n" "$1" | sed -e 's/^.*=//' )"
error_msg "Unknown compression '${attempted_compression}'"
;;
M src/mylib.bash => src/mylib.bash +5 -5
@@ 141,7 141,7 @@ error_msg() {
# Note: exit as error
# Note: ignore Verbose
usage_msg() {
- (>&2 dump_msg "$(/usr/bin/printf "${help_message:=Usage: don\'t}\n" | grep -e 'Usage' | head -n 1)")
+ (>&2 dump_msg "$(/usr/bin/printf "${help_message:=Usage: don\'t}\n" | /usr/bin/grep -e 'Usage' | /usr/bin/head -n 1)")
exit 1
}
@@ 236,9 236,9 @@ prompt_overwrite() {
# else -> original filename up to first .
fn_basename() {
if [[ "$1" = ".*" ]]; then
- printf "%s\n" "$1"
+ /usr/bin/printf "%s\n" "$1"
else
- printf "%s\n" "$1" | cut -f 1 -d '.'
+ /usr/bin/printf "%s\n" "$1" | /usr/bin/cut -f 1 -d '.'
fi
}
@@ 247,9 247,9 @@ fn_basename() {
# else -> original filename after first .
fn_extension() {
if [[ "$1" = ".*" ]]; then
- printf "%s\n" "$1"
+ /usr/bin/printf "%s\n" "$1"
else
- printf "%s\n" "$1" | cut -f 2- -d '.'
+ /usr/bin/printf "%s\n" "$1" | /usr/bin/cut -f 2- -d '.'
fi
}
M src/pactl-get-running-sink => src/pactl-get-running-sink +1 -1
@@ 13,5 13,5 @@ EOF
. /usr/local/lib/myminiparse.sh
-pactl list sinks short | grep -F 'RUNNING' | cut -f 1
+pactl list sinks short | /usr/bin/grep -F 'RUNNING' | /usr/bin/cut -f 1
M src/pactl-volume-printf => src/pactl-volume-printf +1 -1
@@ 25,6 25,6 @@ else
fi
if [ ! -z "$volumes" ]; then
- printf "$format" $volumes
+ /usr/bin/printf "$format" $volumes
fi
M src/qemu-test => src/qemu-test +18 -8
@@ 13,22 13,32 @@ EOF
. /usr/local/lib/myminiparse.sh
-printf_then_exec() {
- printf "%s\n" "$1"
+error_msg() {
+ (>&2 /usr/bin/printf "%s: %s\n" "$name" "$1")
+}
+
+noisily_exec() {
+ /usr/bin/printf "%s\n" "$1"
$1
}
if ! LC_ALL=C lscpu | grep Virtualization >/dev/null 2>&1; then
- printf "Virtualization is not supported by the CPU\n"
- printf_then_exec "LC_ALL=C lscpu | grep Virtualization"
+ if [ "$quiet" -eq 0 ]; then
+ error_msg "Virtualization is not supported by the CPU"
+ noisily_exec "LC_ALL=C lscpu | grep Virtualization"
+ fi
exit 1
elif ! zgrep CONFIG_KVM /proc/config.gz >/dev/null 2>&1; then
- printf "Virtualization is not supported by the kernel\n"
- printf_then_exec "zgrep CONFIG_KVM /proc/config.gz"
+ if [ "$quiet" -eq 0 ]; then
+ error_msg "Virtualization is not supported by the kernel"
+ noisily_exec "zgrep CONFIG_KVM /proc/config.gz"
+ fi
exit 1
elif ! lsmod | grep kvm >/dev/null 2>&1; then
- printf "Kernel modules for virtualization support are not loaded\n"
- printf_then_exec "lsmod | grep kvm"
+ if [ "$quiet" -eq 0 ]; then
+ error_msg "Kernel modules for virtualization support are not loaded"
+ noisily_exec "lsmod | grep kvm"
+ fi
exit 1
fi
exit 0
M src/rebom => src/rebom +1 -1
@@ 22,7 22,7 @@ for arg; do
*)
# main routine
if [ ! -f "$arg" ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$arg")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$arg")
exit 1
else
/usr/bin/printf "\xEF\xBB\xBF"
M src/rmtar => src/rmtar +1 -1
@@ 26,7 26,7 @@ code=0
for arg; do
if [ ! -f "$arg" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$arg")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$arg")
fi
code=1
else
M src/rmzip => src/rmzip +1 -1
@@ 26,7 26,7 @@ code=0
for arg; do
if [ ! -f "$arg" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$arg")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$arg")
fi
code=1
else
M src/tarcat => src/tarcat +1 -1
@@ 19,7 19,7 @@ code=0
for target; do
if [ ! -f "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$target")
fi
code=1
else
M src/tarls => src/tarls +1 -1
@@ 27,7 27,7 @@ code=0
for target; do
if [ ! -f "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$target")
fi
code=1
else
M src/unittest => src/unittest +10 -6
@@ 29,7 29,7 @@ while [ "$#" -gt 0 ]; do
;;
-h|--help)
- printf "%s\n" "$help_message"
+ /usr/bin/printf "%s\n" "$help_message"
exit 0
;;
@@ 45,7 45,7 @@ while [ "$#" -gt 0 ]; do
;;
-V|--version)
- printf "%s %s\n" "$name" "$version"
+ /usr/bin/printf "%s %s\n" "$name" "$version"
exit 0
;;
@@ 97,19 97,23 @@ unittest_discover_subroutine() {
fi
}
+error_msg() {
+ (>&2 /usr/bin/printf "%s: %s\n" "$name" "$1")
+}
+
# check directory
if [ -z "${target+x}" ]; then
- (>&2 printf "Usage: unittest TARGET [OPTIONS]")
+ (>&2 /usr/bin/printf "Usage: unittest TARGET [OPTIONS]\n")
exit 1
elif [ ! -d "$target" ]; then
- if printf "%s\n" "$target" | grep -q -e ".*\.py"; then
+ if /usr/bin/printf "%s\n" "$target" | grep -q -e ".*\.py"; then
single_target=1
else
- (>&2 printf "%s: No such directory '%s'\n" "$name" "$target")
+ error_msg "No such directory '${target}'"
exit 1
fi
elif [ ! -d "$working_directory" ]; then
- (>&2 printf "%s: No such directory '%s'\n" "$name" "$working_directory")
+ error_msg "No such directory '${working_directory}'"
exit 1
fi
M src/untar => src/untar +1 -1
@@ 27,7 27,7 @@ code=0
for target; do
if [ ! -f "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$target")
fi
code=1
else
M src/wg-test => src/wg-test +9 -5
@@ 13,8 13,12 @@ EOF
. /usr/local/lib/myminiparse.sh
+printf_stderr() {
+ (>&2 /usr/bin/printf "%s\n" "$1")
+}
+
if [ $(wg-status | wc -l) -le 1 ]; then
- printf "Wireguard is not running\n"
+ printf_stderr "${name}: Wireguard is not running"
exit 1
fi
@@ 22,10 26,10 @@ fi
# much all upstream documentation
if ! pingable 10.0.0.1; then
- printf "Wireguard server is not reachable; try checking...\n"
- printf " - if the server is running\n"
- printf " - if the server can ping peers\n"
- printf " - if the server firewall is blocking connections\n"
+ printf_stderr "Wireguard server is not reachable; try checking..."
+ printf_stderr " - if the server is running"
+ printf_stderr " - if the server can ping peers"
+ printf_stderr " - if the server firewall is blocking connections"
exit 1
fi
exit 0
M src/whiched => src/whiched +1 -1
@@ 26,7 26,7 @@ for arg; do
target=$(command -v "$arg")
if [ -z "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such directory '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such directory '%s'\n" "$name" "$target")
fi
exit 1
else
M src/whichvi => src/whichvi +1 -1
@@ 26,7 26,7 @@ for arg; do
target=$(command -v "$arg")
if [ -z "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such directory '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such directory '%s'\n" "$name" "$target")
fi
exit 1
else
M src/zipls => src/zipls +1 -1
@@ 27,7 27,7 @@ code=0
for target; do
if [ ! -f "$target" ]; then
if [ "$quiet" -eq 0 ]; then
- (>&2 printf "%s: No such file '%s'\n" "$name" "$target")
+ (>&2 /usr/bin/printf "%s: No such file '%s'\n" "$name" "$target")
fi
code=1
else