Command-line history logging utilities
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

42 lines
587 B

#!/usr/bin/env perl
=pod
=head1 NAME
commandlog-log - show commandlog history
=head1 SYNOPSIS
commandlog log
=head1 AUTHOR
Brennen Bearnes <bbearnes@gmail.com>
=cut
use warnings;
use strict;
use 5.10.0;
use Cwd;
use DBI;
use Sys::Hostname;
use App::CommandLog;
my $dbfile = $ENV{HOME} . "/cli.db";
my $dbh = App::CommandLog::get_dbh($dbfile);
my $sth = $dbh->prepare(q{
SELECT * FROM commands ORDER BY datetime DESC LIMIT 10
});
$sth->execute();
while (my $data = $sth->fetchrow_hashref()) {
say join "\t", $data->{datetime}, $data->{command};
}
$sth->execute();