C Shell Wrapper script for cat command in linux?

General discussion on technical and managerial topics
no avatar
msrikanth
 
Posts: 1
Joined: Fri Jul 20, 2012 7:35 pm
Location: Hyderabad, India

C Shell Wrapper script for cat command in linux?

by msrikanth » Fri Jul 20, 2012 7:41 pm

Hi Everyone,
I have written a C Shell wrapper script for "cat" command in the linux such that whenever any uses the "cat" command and it logs to some file, so the script is as

#!/bin/tcsh -f

set command = /etc/temp/cat
set logfile = /etc/cat_command.log

echo "$LOGNAME + $command $argv " >> $logile
$command $argv

So , i have move the original "cat" command from "/bin" and replaced it with this script so whenever any one uses it logs

But my problem is whenver any user uses as
1) cat sample.txt or cat 1.txt 2.txt , it will log properly
2) cat sample.txt > /tmp/temp.txt , for this only command and arguments are logged but redirection and redirection path is not logged so is there any way to log that path also.

Looking forward your reply as it is urgent. Thanks in Advance

Thanks
Srikanth M.

Return to General Discussion

cron