From 552360a79aab69c8b5f5eeea761c56a60a1f7691 Mon Sep 17 00:00:00 2001 From: Daniil Tsivinsky Date: Tue, 12 Mar 2024 12:03:13 +0300 Subject: [PATCH] ensure name was provided to `bluetooth_battery` script --- bin/bluetooth_battery.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/bluetooth_battery.sh b/bin/bluetooth_battery.sh index 9538a30..02e044a 100755 --- a/bin/bluetooth_battery.sh +++ b/bin/bluetooth_battery.sh @@ -1,6 +1,10 @@ #! /bin/bash name="$1" +if [[ "$name" == "" ]]; then + echo "No name was provided" + exit 1 +fi model_line=$(upower -d | grep -n "$name" | cut -d ':' -f 1) if [[ "$model_line" == "" ]]; then