diff --git a/Bin/set-battery-treshold.sh b/Bin/set-battery-treshold.sh new file mode 100755 index 00000000..66665826 --- /dev/null +++ b/Bin/set-battery-treshold.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env -S bash + +# Check if exectly one argument was provided +if [ "$#" -ne 1 ]; then + echo "Error: Battery level not specified" >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + +# Check if argument is a number +if ! [[ "$1" =~ ^[0-9]+$ ]]; then + echo "Error: Battery level must be a number" >&2 + echo "Usage: $0 " >&2 + exit 1 +fi + +echo "$1" | pkexec tee ~/test