#!/bin/bash DEVICES=$(bluetoothctl paired-devices | cut -f2 -d' '| while read -r uuid do info=`bluetoothctl info $uuid` if echo "$info" | grep -q "Connected: yes"; then echo "$info" | head -n 1 | grep "Device" | awk '{print $2}' fi done) NAMES=$(bluetoothctl paired-devices | cut -f2 -d' '| while read -r uuid do info=`bluetoothctl info $uuid` if echo "$info" | grep -q "Connected: yes"; then echo "$info" | grep "Name" | awk '{for (i=2; i