All pastes #624854 Raw Edit

Untitled

public text v1 · immutable
·published 2007-07-18 16:00 UTC
rendered paste body
$ cat te
#!/bin/sh

if [ "$#" == "0" ]
then
        echo "Usage: same as telnet except with an optional -z flag : -z logfile
name"
        echo "logs to /var/log use the -z switch first, if naming your file"



        exit
fi


if [ "$1" == "-z" ]
then
        logname=$2
        shift 2
else
        logname=$(date +%y%d%h%M%S)
fi


#tee may miss the first line or two of the telnet session
#if desired the script command could be used, which would log the top line
telnet $* | tee -a /var/log/$logname



exit
$