tracefile: added --file.
This commit is contained in:
parent
028d0520cf
commit
9e5ed8416d
20
README
20
README
|
@ -2,6 +2,8 @@ Tools developed by Ole Tange <ole@tange.dk>.
|
|||
|
||||
Probably not useful for you, but then again you never now.
|
||||
|
||||
blink - blink disks in a disk enclosure
|
||||
|
||||
bsearch - binary search through sorted text files.
|
||||
|
||||
em - Force emacs to run in terminal. Use xemacs if installed.
|
||||
|
@ -14,28 +16,36 @@ G - short hand for multi level grep.
|
|||
|
||||
gitnext - Checkout next revision. Opposite of 'checkout HEAD^'.
|
||||
|
||||
gitundo - Undo last commit.
|
||||
histogram - make and display a histogram on the command line.
|
||||
|
||||
neno - No error no output. Only print STDERR and STDOUT if the command fails.
|
||||
|
||||
puniq - Print unique lines the first time they are seen.
|
||||
|
||||
pdfman - Convert man page to pdf and display it using evince.
|
||||
|
||||
rand - Generate (pseudo-)random data
|
||||
puniq - Print unique lines the first time they are seen.
|
||||
|
||||
ramusage - Display the ram usage of a program using `time -v`.
|
||||
|
||||
rand - Generate (pseudo-)random data.
|
||||
|
||||
rclean - Remove files with MD5 sums recorded by rrm (see below).
|
||||
|
||||
reniced - Renice all commands running more than 1 CPU minute unless they are niced or whitelisted.
|
||||
|
||||
rn - Move file(s)/dir(s) to ~/.rm/ (wastebasket).
|
||||
rn - Move file(s)/dir(s) to .rm/ (wastebasket).
|
||||
|
||||
rrm - Record file's MD5 sum before removing it.
|
||||
|
||||
stdout - Redirect both STDERR and STDOUT to STDOUT.
|
||||
|
||||
T - tee stdout to and from temporary files.
|
||||
|
||||
timestamp - prepend timestamp to output.
|
||||
|
||||
tracefile - List files/dirs being accessed by program.
|
||||
|
||||
upsidedown - flip input upside down.
|
||||
|
||||
w4it-for-port-open - Block until the given port opens on a given host.
|
||||
|
||||
wastebasket - VLC extension for moving current file to a wastebasket
|
||||
|
|
|
@ -6,9 +6,9 @@ tracefile - list files being accessed
|
|||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<tracefile> [-adenu] I<command>
|
||||
B<tracefile> [-adefnu] I<command>
|
||||
|
||||
B<tracefile> [-adenu] -p I<pid>
|
||||
B<tracefile> [-adefnu] -p I<pid>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
@ -44,6 +44,13 @@ List only dirs.
|
|||
List only existing files.
|
||||
|
||||
|
||||
=item B<-f>
|
||||
|
||||
=item B<--file>
|
||||
|
||||
List only files.
|
||||
|
||||
|
||||
=item B<-n>
|
||||
|
||||
=item B<--nonexist>
|
||||
|
@ -81,7 +88,8 @@ know which one.
|
|||
Here B<ls> tries to find B</usr/include/shisa.h>. If it fails,
|
||||
B<apt-file> will search for which package it is in:
|
||||
|
||||
tracefile -n -u ls /usr/include/shisa.h | apt-file -f search -
|
||||
tracefile -n -u ls /usr/include/shisa.h | apt-file -f search - |
|
||||
grep /usr/include/shisa.h
|
||||
|
||||
=head1 REPORTING BUGS
|
||||
|
||||
|
@ -90,7 +98,7 @@ Report bugs to <tange@gnu.org>.
|
|||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2012,2016 Ole Tange, http://ole.tange.dk and Free
|
||||
Copyright (C) 2012,2016,2017 Ole Tange, http://ole.tange.dk and Free
|
||||
Software Foundation, Inc.
|
||||
|
||||
|
||||
|
@ -220,7 +228,7 @@ $Global::progname = "tracefile";
|
|||
Getopt::Long::Configure("bundling","pass_through");
|
||||
get_options_from_array(\@ARGV) || die_usage();
|
||||
|
||||
if(not ($opt::exists or $opt::nonexists or $opt::all or $opt::dir)) {
|
||||
if(not ($opt::exists or $opt::nonexists or $opt::all or $opt::dir or $opt::file)) {
|
||||
$opt::all = 1;
|
||||
}
|
||||
|
||||
|
@ -240,17 +248,16 @@ while(<IN>) {
|
|||
my $file = shell_unquote($1);
|
||||
# Relative to $dir
|
||||
$file =~ s:^([^/]):$dir/$1:;
|
||||
my $print = 0;
|
||||
if($opt::all
|
||||
my $print = 1;
|
||||
if(($opt::dir and not -d $file)
|
||||
or
|
||||
($opt::exists and -e $file)
|
||||
($opt::file and not -f $file)
|
||||
or
|
||||
($opt::dir and -d $file)
|
||||
($opt::exists and not -e $file)
|
||||
or
|
||||
($opt::nonexists and not -e $file)) {
|
||||
$print = 1;
|
||||
}
|
||||
if($opt::unique and $seen{$file}++) {
|
||||
($opt::nonexists and -e $file)
|
||||
or
|
||||
($opt::unique and $seen{$file}++)) {
|
||||
$print = 0;
|
||||
}
|
||||
$print and print $file,"\n";
|
||||
|
@ -262,6 +269,7 @@ sub options_hash {
|
|||
return
|
||||
("debug|D" => \$opt::debug,
|
||||
"dir|d" => \$opt::dir,
|
||||
"file|f" => \$opt::file,
|
||||
"uniq|unique|u" => \$opt::unique,
|
||||
"exists|exist|e" => \$opt::exists,
|
||||
"nonexists|nonexist|non-exists|non-exist|n" => \$opt::nonexists,
|
||||
|
|
Loading…
Reference in a new issue