Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log command use

Status
Not open for further replies.

vodkadrinker

Technical User
Joined
May 16, 2002
Messages
163
Location
GB
I would like to log a command use of rm, user date and file etc, I thought this would be straight forward using the following script.

cat rm
echo `who am i` $1 >> /tmp/rmlog
/usr/bin/rmafile $1

rmafile now being the original rm.

However you can put options and more than one file after the rm command so $1 is not enough. I have put in $1 $2 $3 $4 $5 to get round the problem, is there a better way to do this?
 
echo `who am i` "${@}" >> /tmp/rmlog
/usr/bin/rmafile "${@}"

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
This worked a treat many thanks for your help :)

VD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top