Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re^4: How to let perl knows if somebody copies a file

by rovf (Priest)
on Sep 17, 2012 at 09:17 UTC ( #993997=note: print w/replies, xml ) Need Help??

in reply to Re^3: How to let perl knows if somebody copies a file
in thread How to let perl knows if somebody copies a file

I thought there was a file like /etc/profile for per-interactive-shell startup.
Using /etc/profile for type of work has the drawback, that this file is not sourced always, but only if the bash is invoked as login-shell, and the --noprofile option is not used.

Which is what the OP asked.

Not sure of this. The OP said f somebody uses the copy command in bash, which is different from saying if somebody uses the command 'cp' from the command line. For example, the user might invoke a shell script, which contains a command to copy the file (maybe cp, maybe a different one), and this would then not necessarily be monitored.

Honestly, I don't know the deeper purpose for the OP's request. If he just want to spare his users the task to explicitly run his Perl scripts after each copying process, he could simply provide a script for doing copying+inspecting, and ask the users to run his script instead of using the original cp commmand. Of course, any user is then free to put an alias to this script in his or her .bashrc, and this would work in a similar way for ksh or zsh too.

On the other hand, if the OP wants to enforce this type of check, because he suspects that the users, on purpose, might not use his script, all alternatives discussed here are very easy to bypass.
Ronald Fischer <>

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993997]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2018-01-20 20:03 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (227 votes). Check out past polls.