in reply to perl, system() calls, and shell history

As other people have said, the command history is a feature of the shell, and only stores interactive commands, not non-interactive ones, such as those launched from a Perl system() function call.

To expand upon Corion's answer - using truss (or analogues) will probably not get you what you want. What it will get you is a list of system calls (that is, kernel level system calls such as getuid() or chmod() ) that the process executes. If you truss the Perl program that executes the system() function (function as distinct from system call), you will get the system calls executed by the Perl binary, the shell called to execute your commands, and your commands. This might be too many trees to keep seeing the wood.

As to accounting, you can do that (process accounting, see the link Bronto provided), but for just logging what your Perl script does, this might be a bit over the top as well.

If you want to keep track of what the script does when, you could always write a wrapper around system() that logs the command executed to a file and then executes the command normally:

sub my_system { my @command = @_; print LOGFILE join " ", @command; warn "This code is untested."; system (@command); }

CU
Robartes-