niceties
This commit is contained in:
19
niceties/battery
Executable file
19
niceties/battery
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
subprogram="$(command -v "$0")"
|
||||
if ! str isvalue "$subprogram" && ! test -e "$0"; then
|
||||
printf "%s: can't find myself!\n" "$0"
|
||||
exit 70 # sysexits(3) EX_SOFTWARE
|
||||
else
|
||||
subprogram="$0"
|
||||
fi
|
||||
|
||||
# battery -> battery.linux battery.netbsd etc
|
||||
subprogram="$0"."$(uname | lowercase)"
|
||||
|
||||
if ! command -v "$subprogram" >/dev/null 2>&1 && ! test -e "$subprogram"; then
|
||||
printf "%s: unsupported system\n" "$(uname)" 1>&2
|
||||
exit 70 # sysexits(3) EX_SOFTWARE
|
||||
fi
|
||||
|
||||
"$subprogram" || exit 70 # sysexits(3) EX_SOFTWARE
|
||||
Reference in New Issue
Block a user