#!/bin/fish function m50x set -l mac "00:0A:45:44:82:12" set -l conn $( bluetoothctl devices Connected ) if test -z $conn if bluetoothctl connect $mac > /dev/null echo "Connection successful" end else if bluetoothctl disconnect > /dev/null echo "Disconnection successful" end end end