From 282ade689c05bb61e90fdb1a6568f89915bf1d76 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Fri, 3 Jul 2020 17:55:45 +0200 Subject: [PATCH] Add subcommands --- .bin/reverse-tether-linux-android | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.bin/reverse-tether-linux-android b/.bin/reverse-tether-linux-android index 30020e7..c0cec5f 100755 --- a/.bin/reverse-tether-linux-android +++ b/.bin/reverse-tether-linux-android @@ -1,5 +1,23 @@ #!/usr/bin/env bash -adb kill-server -adb start-server -gnirehtet autorun +function start() { + adb start-server + nohup gnirehtet autorun &> /dev/null & + echo "Started reverse tethering" +} + +function stop() { + adb kill-server + gnirehtet stop + pkill gnirehtet + echo "Stopped reverse tethering" +} + +case "$1" in + start) start ;; + stop) stop ;; + restart) stop; start ;; + *) echo "start | stop | restart" >&2 + exit 1 + ;; +esac