1#!/usr/bin/env bash 2 3bt_cmd=${1:-connect} 4 5devices="$(echo 'devices' | bluetoothctl | grep '^Device' | sed "s/^[^ ]* //")" 6 7awk -v bt_cmd="$bt_cmd" '{printf("power on\n%s %s\n", bt_cmd, $1)}' < <(\ 8 echo "$devices" | @dmenu@ "Select device to $bt_cmd:" 9) > >(bluetoothctl) 10