Skip to content

Instantly share code, notes, and snippets.

@akirattii
Last active October 30, 2016 22:28
Show Gist options
  • Save akirattii/a8ecd3935a8df127867fc67737a24ba9 to your computer and use it in GitHub Desktop.
Save akirattii/a8ecd3935a8df127867fc67737a24ba9 to your computer and use it in GitHub Desktop.
NetworkManagerで登録済みのアクセスポイントにコマンドラインからBT接続するためのシェル ($ ./mobile-internet.sh { up | down })
#!/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