diff options
author | Saumit Dinesan <79687674+Saumit-D@users.noreply.github.com> | 2022-01-25 23:04:43 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-25 23:04:43 +0530 |
commit | d71e6f7e1cb441b994839511641aa33e455d824c (patch) | |
tree | af2443896274512912fb90a68b4f0ea581b7e51a /scripts/bts | |
parent | 4c3e9e6e44dfdc75d079276a7836006298fea562 (diff) |
Update bts
using grep and cut for first time... I believe the code can get much much smaller
Diffstat (limited to 'scripts/bts')
-rw-r--r-- | scripts/bts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/bts b/scripts/bts index 2900ef9..0acdefd 100644 --- a/scripts/bts +++ b/scripts/bts @@ -1,4 +1,10 @@ -bluetoothctl power on -bluetoothctl connect A1:B3:EC:B1:53:60 -bluetoothctl connect A1:B3:EC:B1:53:60 - +status=$(systemctl status bluetooth | grep active | cut -d " " -f 7) +case $status in + "active") + bluetoothctl power on + bluetoothctl connect A1:B3:EC:B1:53:60 ;; + "inactive") + sudo systemctl start bluetooth + bluetoothctl power on + bluetoothctl connect A1:B3:EC:B1:53:60;; +esac |