Last active
July 21, 2019 16:32
-
-
Save dododevs/7a78bedf4330841621ad8d38b1544cea to your computer and use it in GitHub Desktop.
The magic of the expect command on Linux
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
#!/usr/bin/env expect | |
spawn bluetoothctl # start the process you want to talk with | |
expect -re {\[bluetooth\]} # wait for a particular input to come in based on the regex | |
send "default-agent" # generate whatever output and send it to the process | |
send "\n" | |
interact # drop to an interactive session with the open process |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment