From 1e8d930ef057022add3098fb8c9a3b558894efb3 Mon Sep 17 00:00:00 2001 From: guanghongwei Date: Mon, 22 Dec 2014 17:01:37 +0800 Subject: [PATCH] del import module --- connect.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/connect.py b/connect.py index 8c7edac27..c099f13b0 100755 --- a/connect.py +++ b/connect.py @@ -6,11 +6,10 @@ import os import select import time import paramiko -import sys import struct import fcntl import signal -import socket + try: import termios @@ -117,8 +116,8 @@ def connect(username, password, host, port): """ Connect server. """ - - ps1 = "'[\u@%s \W]\$ '\n" % host + ps1 = "PS1='[\u@%s \W]\$ '\n" % host + login_msg = "clear;echo -e '\\033[32mLogin %s done. Enjoy it.\\033[0m'\n" % host # Make a ssh connection ssh = paramiko.SSHClient() @@ -141,9 +140,9 @@ def connect(username, password, host, port): except: pass - # Modify PS1 - channel.send('PS1=%s' % ps1) - channel.send("clear;echo -e '\\033[32mLogin %s done. Enjoy it.\\033[0m'\n" % host) + # set PS1 and msg it + channel.send(ps1) + channel.send(login_msg) # Make ssh interactive tunnel posix_shell(channel, username, host)