From ce3d6a6ed493e64f94ad649b9dd9536285f960cc Mon Sep 17 00:00:00 2001 From: TheK4n Date: Wed, 16 Nov 2022 15:55:01 +0300 Subject: [PATCH] feat(functions/bluetooth): number of attemts if connect errors --- functions/bluetooth | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/functions/bluetooth b/functions/bluetooth index 449be4f..129039e 100755 --- a/functions/bluetooth +++ b/functions/bluetooth @@ -1,4 +1,16 @@ #!/bin/sh bssid="$(bluetoothctl devices | dmenu -p "Devices: " -l 20 | cut -d' ' -f2)" -bluetoothctl connect "$bssid" + +exit_counter=0 +until bluetoothctl connect "$bssid" +do + ((exit_counter+=1)) + + if [ "$exit_counter" -gt 3 ]; then + break + else + echo ... + sleep 1 + fi +done