From 1fa9efd6de57133ff012efeb42eb41597c705c3d Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 2 Nov 2013 09:47:31 +0100 Subject: more flexible, the commands got using ssh, login and locking the screen can be replace or extended MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- got | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'got') diff --git a/got b/got index a248961..a2325cc 100755 --- a/got +++ b/got @@ -65,17 +65,38 @@ login_function=_login _login () { if [ ! "${user%@*}" = "${user}" ]; then - setsid -c @ssh@ ${user} || sleep 3 - # The sleep allows you to see any error you made + $_use_ssh_function elif [ ! "${user}" = "" ] && [ "${user%%-*}" = "" ]; then - stty -icanon -echo -isig -ixon -ixoff -ixany - echo -e '\e[01;31mNice try! Sleeping for 10 minutes...\e[00m' - sleep 600 + $_lock_tty_function else - setsid -c login -- "${user}" + $_use_login_function fi } +# Function for locking the TTY +_lock_tty_function=_lock_tty +_lock_tty () +{ + stty -icanon -echo -isig -ixon -ixoff -ixany + echo -e '\e[01;31mNice try! Sleeping for 10 minutes...\e[00m' + sleep 600 +} + +# Function for performing the log in with `ssh` +_use_ssh_function=_use_ssh +_use_ssh () +{ + setsid -c ssh ${user} || sleep 3 + # The sleep allows you to see any error you made +} + +# Function for performing the log in with `login` +_use_login_function=_use_login +_use_login () +{ + setsid -c login -- "${user}" +} + # Load OS information and extensions NAME="$(uname -o)" -- cgit v1.2.3-70-g09d2