#!/bin/bash ################################################## ### This script activates your bluetooth service. ### It also powers on bluetoothctl. ### To use it type: ### bluetooth.sh on [[ -L "/sbin/init" ]] && sys='systemd' || sys='systemV' on() { if [[ "$sys" = "systemV" ]]; then sudo /etc/rc.d/rc.bluetooth start elif [[ "$sys" = "systemd" ]]; then sudo systemctl start bluetooth.service sudo systemctl start bluealsa.service else echo "Init system unkown" && exit fi echo -e "power on" | bluetoothctl } off() { echo -e "power off" | bluetoothctl if [[ "$sys" = "systemV" ]]; then sudo /etc/rc.d/rc.bluetooth stop elif [[ "$sys" = "systemd" ]]; then sudo systemctl stop bluetooth.service sudo systemctl stop bluealsa.service else echo "Init system unkown" && exit fi } "$@"