Last active
October 30, 2016 22:28
-
-
Save akirattii/a8ecd3935a8df127867fc67737a24ba9 to your computer and use it in GitHub Desktop.
NetworkManagerで登録済みのアクセスポイントにコマンドラインからBT接続するためのシェル ($ ./mobile-internet.sh { up | down })
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
| #!/bin/bash | |
| # | |
| # Usage: | |
| # ### Connect: | |
| # $ ./mobile-internet up | |
| # ### Disconnect: | |
| # $ ./mobile-internet down | |
| # | |
| # name of the accesspoint on NetworkManager | |
| networkname="ネットワークアクセスポイント on aterm-xxxxxx" | |
| # 'up' or 'down' | |
| updown=$1 | |
| if [ $# -ne 1 ]; then | |
| echo "Needs an argument 'up' or 'down'. Nothing is done." | |
| exit | |
| fi | |
| if [ $updown = 'up' ]; then | |
| echo "Connecting to '${networkname}'..." | |
| else | |
| echo "Disconnecting '${networkname}'..." | |
| fi | |
| nmcli con $updown "$networkname" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment