File: telnet_loop

package info (click to toggle)
ltsp 0.99debian11
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 976 kB
  • ctags: 103
  • sloc: sh: 1,320; python: 485; ansic: 436; lex: 152; makefile: 129; yacc: 58
file content (57 lines) | stat: -rwxr-xr-x 1,214 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
#
# Copyright (c) 2002 by James A. McQuillan (McQuillan Systems, LLC)
#
# This software is licensed under the Gnu General Public License version 2,
# the full text of which can be found in the COPYING file.
#
#
# Enter a loop, running telnet to the server.
#

if [ $# -ne 1 ]; then
    echo "Usage:  $0 <hostname or ip addr>"
    exit 1
fi

#
# Set the terminal type, so that the remote host will
# have a clue what kind of terminal you are using.
#
export TERM=linux               # Setup the terminal type

#
# Get this terminal name, to display on the top line of the screen
#
TTY=`/usr/bin/basename \`/usr/bin/tty\``
[ "${TTY}" = "console" ] && TTY="tty1"    # Special case for first screen

REMOTE=$1

while :; do
    #
    # Clear the screen, to place cursor at the top
    #
    /usr/bin/clear

    #
    # Echo this message, telling user how to proceed.
    #
    echo -n "${TTY}, Press <enter> to establish a connection to the server..."
    read CMD

    #
    # Clear the screen before launching telnet
    #
    /usr/bin/clear

    #
    # Launch the telnet program.
    #
    /usr/bin/telnet ${REMOTE}

    #
    # Brief pause, incase telnet had errors to report
    #
    /bin/sleep 2
done