Forked from ircykk/gist:c35591ab0384f1d35a592ffa08029618
Created
March 19, 2023 11:04
-
-
Save mirbehroznoor/d974946eb56f3426250903e8d94aef1d 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