diff --git a/scripts/termux-api-start.in b/scripts/termux-api-start.in index f06d91d..b4b4311 100644 --- a/scripts/termux-api-start.in +++ b/scripts/termux-api-start.in @@ -1,2 +1,4 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + am startservice -n com.termux.api/.KeepAliveService diff --git a/scripts/termux-api-stop.in b/scripts/termux-api-stop.in index cf23769..6f66c9d 100644 --- a/scripts/termux-api-stop.in +++ b/scripts/termux-api-stop.in @@ -1,2 +1,4 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + am stopservice -n com.termux.api/.KeepAliveService diff --git a/scripts/termux-audio-info.in b/scripts/termux-audio-info.in index 5add06f..eab7d2c 100644 --- a/scripts/termux-audio-info.in +++ b/scripts/termux-audio-info.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-audio-info diff --git a/scripts/termux-battery-status.in b/scripts/termux-battery-status.in index 919535a..66dc483 100644 --- a/scripts/termux-battery-status.in +++ b/scripts/termux-battery-status.in @@ -1,18 +1,27 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-battery-status show_usage () { - echo "Usage: $SCRIPTNAME" - echo "Get the status of the device battery." + RESET='\e[0m' + LABEL='\e[96m' + + echo -e "${LABEL}Usage${RESET}: $SCRIPTNAME +Get the status of the device battery." exit 0 } +specification=:h +option_names_as_string="$(echo "$specification" | sed 's/://g' | sed -r 's/(.)/ -\1/g')" +read -r -a option_names_as_array <<< "$option_names_as_string" + while getopts :h option do case "$option" in h) show_usage;; - ?) echo "$SCRIPTNAME: illegal option -$OPTARG"; exit 1; + ?) echo "$SCRIPTNAME: illegal option -$OPTARG, expected one of ${option_names_as_array[*]}"; exit 1; esac done shift $((OPTIND-1)) diff --git a/scripts/termux-camera-info.in b/scripts/termux-camera-info.in index 32fcbd9..64d0f1a 100644 --- a/scripts/termux-camera-info.in +++ b/scripts/termux-camera-info.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-camera-info diff --git a/scripts/termux-camera-photo.in b/scripts/termux-camera-photo.in index 62d5751..1a39e60 100644 --- a/scripts/termux-camera-photo.in +++ b/scripts/termux-camera-photo.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-camera-photo diff --git a/scripts/termux-clipboard-get.in b/scripts/termux-clipboard-get.in index 24b9f35..b88d3c8 100644 --- a/scripts/termux-clipboard-get.in +++ b/scripts/termux-clipboard-get.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-clipboard-get diff --git a/scripts/termux-clipboard-set.in b/scripts/termux-clipboard-set.in index c401a7f..69f11c4 100644 --- a/scripts/termux-clipboard-set.in +++ b/scripts/termux-clipboard-set.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-clipboard-set diff --git a/scripts/termux-contact-list.in b/scripts/termux-contact-list.in index 90b1024..1843526 100644 --- a/scripts/termux-contact-list.in +++ b/scripts/termux-contact-list.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-contact-list diff --git a/scripts/termux-download.in b/scripts/termux-download.in index 83da2f1..670cc64 100644 --- a/scripts/termux-download.in +++ b/scripts/termux-download.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-download diff --git a/scripts/termux-fingerprint.in b/scripts/termux-fingerprint.in index ecb40b8..df4ac84 100644 --- a/scripts/termux-fingerprint.in +++ b/scripts/termux-fingerprint.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-fingerprint diff --git a/scripts/termux-infrared-frequencies.in b/scripts/termux-infrared-frequencies.in index f7a494c..77bbcb5 100644 --- a/scripts/termux-infrared-frequencies.in +++ b/scripts/termux-infrared-frequencies.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-infrared-frequencies diff --git a/scripts/termux-infrared-transmit.in b/scripts/termux-infrared-transmit.in index 81c912a..ad58ba9 100644 --- a/scripts/termux-infrared-transmit.in +++ b/scripts/termux-infrared-transmit.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-infrared-transmit diff --git a/scripts/termux-job-scheduler.in b/scripts/termux-job-scheduler.in index 26c9ec1..cf0b58b 100644 --- a/scripts/termux-job-scheduler.in +++ b/scripts/termux-job-scheduler.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/bash +# shellcheck shell=bash + set -e -u -f SCRIPTNAME=termux-job-scheduler diff --git a/scripts/termux-keystore.in b/scripts/termux-keystore.in index d6d7ccc..0544ced 100644 --- a/scripts/termux-keystore.in +++ b/scripts/termux-keystore.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u readonly CMD_BASE="@TERMUX_PREFIX@/libexec/termux-api Keystore" diff --git a/scripts/termux-location.in b/scripts/termux-location.in index 7c9eb96..dc08e39 100644 --- a/scripts/termux-location.in +++ b/scripts/termux-location.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-location diff --git a/scripts/termux-notification-list.in b/scripts/termux-notification-list.in index 2015197..99901dd 100644 --- a/scripts/termux-notification-list.in +++ b/scripts/termux-notification-list.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-notification-list diff --git a/scripts/termux-notification-remove.in b/scripts/termux-notification-remove.in index 62b1c9d..cd52de9 100644 --- a/scripts/termux-notification-remove.in +++ b/scripts/termux-notification-remove.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-notification-remove diff --git a/scripts/termux-saf-create.in b/scripts/termux-saf-create.in index 8b50e16..a9e19a4 100644 --- a/scripts/termux-saf-create.in +++ b/scripts/termux-saf-create.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-create diff --git a/scripts/termux-saf-dirs.in b/scripts/termux-saf-dirs.in index e62e4df..87f4b65 100644 --- a/scripts/termux-saf-dirs.in +++ b/scripts/termux-saf-dirs.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-dirs diff --git a/scripts/termux-saf-ls.in b/scripts/termux-saf-ls.in index 7aeb807..0a279ae 100644 --- a/scripts/termux-saf-ls.in +++ b/scripts/termux-saf-ls.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-ls diff --git a/scripts/termux-saf-managedir.in b/scripts/termux-saf-managedir.in index 1567033..2ea9612 100644 --- a/scripts/termux-saf-managedir.in +++ b/scripts/termux-saf-managedir.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-managedir diff --git a/scripts/termux-saf-mkdir.in b/scripts/termux-saf-mkdir.in index 2dbc28d..2923472 100644 --- a/scripts/termux-saf-mkdir.in +++ b/scripts/termux-saf-mkdir.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-mkdir diff --git a/scripts/termux-saf-read.in b/scripts/termux-saf-read.in index 89c195e..d17161a 100644 --- a/scripts/termux-saf-read.in +++ b/scripts/termux-saf-read.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-read diff --git a/scripts/termux-saf-rm.in b/scripts/termux-saf-rm.in index 0d41316..ea9e6c2 100644 --- a/scripts/termux-saf-rm.in +++ b/scripts/termux-saf-rm.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-rm diff --git a/scripts/termux-saf-stat.in b/scripts/termux-saf-stat.in index 8a49f4e..ee61726 100644 --- a/scripts/termux-saf-stat.in +++ b/scripts/termux-saf-stat.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-stat diff --git a/scripts/termux-saf-write.in b/scripts/termux-saf-write.in index 5109bde..e94e945 100644 --- a/scripts/termux-saf-write.in +++ b/scripts/termux-saf-write.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-saf-write diff --git a/scripts/termux-share.in b/scripts/termux-share.in index 90177d5..10aa54d 100644 --- a/scripts/termux-share.in +++ b/scripts/termux-share.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-share diff --git a/scripts/termux-sms-inbox.in b/scripts/termux-sms-inbox.in index bf26917..226f2c8 100644 --- a/scripts/termux-sms-inbox.in +++ b/scripts/termux-sms-inbox.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + echo "termux-sms-inbox: This script has been replaced by termux-sms-list." exit 1 diff --git a/scripts/termux-sms-list.in b/scripts/termux-sms-list.in index dbeab67..7921a50 100644 --- a/scripts/termux-sms-list.in +++ b/scripts/termux-sms-list.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -u PARAM_LIMIT=10 diff --git a/scripts/termux-sms-send.in b/scripts/termux-sms-send.in index 8a1bd4c..f6edc54 100644 --- a/scripts/termux-sms-send.in +++ b/scripts/termux-sms-send.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-sms-send diff --git a/scripts/termux-speech-to-text.in b/scripts/termux-speech-to-text.in index 4bc7fd0..de5c168 100644 --- a/scripts/termux-speech-to-text.in +++ b/scripts/termux-speech-to-text.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-speech-to-text diff --git a/scripts/termux-storage-get.in b/scripts/termux-storage-get.in index 86b236e..598921b 100644 --- a/scripts/termux-storage-get.in +++ b/scripts/termux-storage-get.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-storage-get diff --git a/scripts/termux-telephony-call.in b/scripts/termux-telephony-call.in index 5a61015..1ccbe6a 100644 --- a/scripts/termux-telephony-call.in +++ b/scripts/termux-telephony-call.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-telephony-call diff --git a/scripts/termux-telephony-cellinfo.in b/scripts/termux-telephony-cellinfo.in index e5c3d30..56db2b4 100644 --- a/scripts/termux-telephony-cellinfo.in +++ b/scripts/termux-telephony-cellinfo.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-telephony-cellinfo diff --git a/scripts/termux-telephony-deviceinfo.in b/scripts/termux-telephony-deviceinfo.in index 14115dc..627dda4 100644 --- a/scripts/termux-telephony-deviceinfo.in +++ b/scripts/termux-telephony-deviceinfo.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-telephony-deviceinfo diff --git a/scripts/termux-torch.in b/scripts/termux-torch.in index cf30efb..b7c98de 100644 --- a/scripts/termux-torch.in +++ b/scripts/termux-torch.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-torch diff --git a/scripts/termux-tts-engines.in b/scripts/termux-tts-engines.in index af0959b..591b2fe 100644 --- a/scripts/termux-tts-engines.in +++ b/scripts/termux-tts-engines.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-tts-engines diff --git a/scripts/termux-tts-speak.in b/scripts/termux-tts-speak.in index bd95037..ed19951 100644 --- a/scripts/termux-tts-speak.in +++ b/scripts/termux-tts-speak.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-tts-speak diff --git a/scripts/termux-vibrate.in b/scripts/termux-vibrate.in index 36b03fa..270f1ad 100644 --- a/scripts/termux-vibrate.in +++ b/scripts/termux-vibrate.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-vibrate diff --git a/scripts/termux-wifi-connectioninfo.in b/scripts/termux-wifi-connectioninfo.in index dde982f..2754ec7 100644 --- a/scripts/termux-wifi-connectioninfo.in +++ b/scripts/termux-wifi-connectioninfo.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-wifi-connectioninfo diff --git a/scripts/termux-wifi-enable.in b/scripts/termux-wifi-enable.in index 9e9a1ef..d3f5521 100644 --- a/scripts/termux-wifi-enable.in +++ b/scripts/termux-wifi-enable.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-wifi-enable diff --git a/scripts/termux-wifi-scaninfo.in b/scripts/termux-wifi-scaninfo.in index 85b5fdb..9efe6f0 100644 --- a/scripts/termux-wifi-scaninfo.in +++ b/scripts/termux-wifi-scaninfo.in @@ -1,4 +1,6 @@ #!@TERMUX_PREFIX@/bin/sh +# shellcheck shell=bash + set -e -u SCRIPTNAME=termux-wifi-scaninfo