Created
December 14, 2014 16:30
-
-
Save farfanoide/5d974f04a08facfdfb6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 bash | |
| # ------------------------------------------------------------------------------ | |
| # Description | |
| # ----------- | |
| # | |
| # Simple script to toggle bluetooth on and off on a mac. | |
| # Depends on: | |
| # - blueutil: (https://github.com/toy/blueutil) | |
| # | |
| # ------------------------------------------------------------------------------ | |
| # Author | |
| # ------- | |
| # | |
| # * Farfanoide (https://github.com/farfanoide) | |
| # | |
| # ------------------------------------------------------------------------------ | |
| if ! command blueutil 2> /dev/null; then | |
| cat <<EOS | |
| [EROR] - blueutil not found | |
| [INFO] - You can download it here: | |
| [INFO] - https://github.com/toy/blueutil | |
| EOS | |
| exit 1 | |
| fi | |
| _bt_status() { blueutil | head -1 | cut -d':' -f2 | tr -d ' ' ;} | |
| [ "$(_bt_status)" = '0' ] && status=1 || status=0 | |
| blueutil power $status |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment