devdaily home | apple | java | perl | unix | directory | blog

What this is

This file is included in the DevDaily.com "Bourne Shell Source Code Warehouse" project. The intent of this project is to help you "Learn Bourne Shell by Example" TM.

Other links

The source code

#!/bin/sh
# logstrokes version 1.2
# writes all keystrokes to [logfile] and sends them to 
# the shell to be executed
# Allows you to create a shell script for a series 
# of commands as you do them
#
# usage: logstrokes [file to log to]
# when done, ctr-c to stop logging

# comments / improvements: support@webmastersguide.com

# history:
# 1.2 Fixed script so logfile could be entered as
#     either a full path or a relative path, without a switch
#
# 1.1 Initial release - required r switch

case $1 in
"")echo "usage: logstrokes [file to log to]"; exit 1;;
-*) shift;;
esac

case $1 in
/.*) logfile="$1";;
*) logfile="`pwd`/$1";;
esac
echo "logging to $logfile"

touch $logfile
chmod 755 $logfile

while :
do
	echo -n "[`pwd`]# "
	read args
	echo "$args" >>$logfile
	$args
done




Copyright 1998-2008 Alvin Alexander
All Rights Reserved.
 
devdaily.com is based in louisville, kentucky, and this web site is hosted by godaddy.com