#!/bin/sh if [ "$#" == "0" ] then echo "Usage: same as ssh except with an optional -z flag : -z logfile name" echo "logs to /var/log, use -z first if naming your file" #add ssh to show ssh usage ssh exit fi #check for logfile name option, if so shift arguments if [ "$1" == "-z" ] then logname=$2 shift 2 else logname=$(date +%y%d%h%M%S) fi #tee misses the first line or two, you may wish to use script ssh $* | tee -a /var/log/$logname exit