Created
April 14, 2018 10:26
-
-
Save ircykk/c35591ab0384f1d35a592ffa08029618 to your computer and use it in GitHub Desktop.
Linux bluetoothctl auto pair and connect device
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
coproc bluetoothctl | |
echo -e 'scan on\n' >&${COPROC[1]} | |
sleep 3 | |
echo -e 'remove AA:AA:AA:AA:AA:AA\n' >&${COPROC[1]} | |
sleep 1 | |
echo -e 'pair AA:AA:AA:AA:AA:AA\n' >&${COPROC[1]} | |
sleep 1 | |
echo -e 'connect AA:AA:AA:AA:AA:AA\n' >&${COPROC[1]} | |
sleep 1 | |
echo -e 'scan off\n' >&${COPROC[1]} | |
echo -e 'exit\n' >&${COPROC[1]} | |
output=$(cat <&${COPROC[0]}) | |
echo $output | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script!