I'm trying to call "history" from a perl script but it keeps saying "Can't exec "history": No such file or directory at gatherinformation.pl line 7." Script:
#!/usr/bin/perl
use strict;
use warnings;
open(my $fich ,">>/home/osboxes/Desktop/ConteudosServer/Plano de contingencia/history_report.txt");
`history`;
I have tried only using history
in the script but it keeps giving me the same error.
I'm have been messing around with the HISTFILESIZE and HISTFILE variables to output "%h/%d -- %H:%M:%S ". Heres is the line in the bashrc file:
export HISTTIMEFORMAT="%h/%d -- %H:%M:%S "
I have tried both of these answers: Can't exec No such file or directory
perl script error: Can't exec "module": No such file or directory at ./prog line 2
I don't think it's usefull to start another question just to ask this: is there a way to get the history
directly from the file ./bash_history
with date and time? I don't think it's usefull having to call shell commands to such a simple task.