App::BashHistoryUtils - CLI utilities related to bash history file
This document describes version 0.070 of App::BashHistoryUtils (from Perl distribution App-BashHistoryUtils), released on 2021-05-26.
This distribution includes the following CLI utilities:
delete-bash-history-entries
each-bash-history-entry
grep-bash-history-entries
Usage:
delete_bash_history_entries(%args) -> [$status_code, $reason, $payload, \%result_meta]
Delete matching entries from bash history file.
This function is not exported.
This function supports dry-run operation.
Arguments ('*' denotes required arguments):
histfile => str (default: "/home/u1/.bash_history")
ignore_case => bool
inplace => bool
Replace original bash history file.
invert_match => bool
max_age => duration
Match entries older than a certain age.
min_age => duration
Match entries younger than a certain age.
pattern => re
Match entries using a regex pattern.
strip_timestamp => bool
Strip timestamps.
Special arguments:
-dry_run => bool
Pass -dry_run=>1 to enable simulation mode.
Returns an enveloped result (an array).
First element ($status_code) is an integer containing HTTP-like status code (200 means OK, 4xx caller error, 5xx function error). Second element ($reason) is a string containing error message, or something like "OK" if status is 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth element (%result_meta) is called result metadata and is optional, a hash that contains extra information, much like how HTTP response headers provide additional metadata.
Return value: (any)
each_bash_history_entry(%args) -> [$status_code, $reason, $payload, \%result_meta]
Run Perl code for each bash history entry.
code* => str
Perl code to run for each entry.
Inside the code, you can set $PRINT to 0 to suppress the output of the entry. You can modify $_ to modify the entry. $TS (timestamp) is also available.
$PRINT
$_
$TS
grep_bash_history_entries(%args) -> [$status_code, $reason, $payload, \%result_meta]
Show matching entries from bash history file.
Please visit the project's homepage at https://metacpan.org/release/App-BashHistoryUtils.
Source repository is at https://github.com/perlancar/perl-App-BashHistoryUtils.
Please report any bugs or feature requests on the bugtracker website https://github.com/perlancar/perl-App-BashHistoryUtils/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Bash::History::Read
perlancar <perlancar@cpan.org>
This software is copyright (c) 2021, 2017, 2016, 2015 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install App::BashHistoryUtils, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::BashHistoryUtils
CPAN shell
perl -MCPAN -e shell install App::BashHistoryUtils
For more information on module installation, please visit the detailed CPAN module installation guide.