-v is nu verbose; laat zien wat er gebeurt
-t is voor test
This commit is contained in:
parent
52c46b71a4
commit
ff4d7f1210
1 changed files with 9 additions and 6 deletions
|
|
@ -103,9 +103,10 @@ sub move_files {
|
||||||
chomp($source);
|
chomp($source);
|
||||||
chomp($target);
|
chomp($target);
|
||||||
unless ( $source eq $target ) {
|
unless ( $source eq $target ) {
|
||||||
if ($opt_v) {
|
if ($opt_v||$opt_t) {
|
||||||
print "mv $source $target\n";
|
print "mv $source $target\n";
|
||||||
} else {
|
}
|
||||||
|
unless ($opt_t) {
|
||||||
move("$source", "$target")
|
move("$source", "$target")
|
||||||
or die "move failed: $!";
|
or die "move failed: $!";
|
||||||
}
|
}
|
||||||
|
|
@ -198,9 +199,10 @@ sub safety_belt {
|
||||||
$filename = $source->[$filenr];
|
$filename = $source->[$filenr];
|
||||||
chomp $filename;
|
chomp $filename;
|
||||||
$rand = &rand_file;
|
$rand = &rand_file;
|
||||||
if ($opt_v) {
|
if ($opt_v||$opt_t) {
|
||||||
print "mv $filename $rand\n";
|
print "mv $filename $rand\n";
|
||||||
} else {
|
}
|
||||||
|
unless ($opt_t) {
|
||||||
move("$filename", "$rand")
|
move("$filename", "$rand")
|
||||||
or die "move failed: $!";
|
or die "move failed: $!";
|
||||||
}
|
}
|
||||||
|
|
@ -241,7 +243,7 @@ sub unlock {
|
||||||
|
|
||||||
sub cmdline {
|
sub cmdline {
|
||||||
%optctl = ();
|
%optctl = ();
|
||||||
&GetOptions("e=s", "h", "p=s", \@pattern, "f=s", "v");
|
&GetOptions("e=s", "h", "p=s", \@pattern, "f=s", "v", "t");
|
||||||
&GetOptions(\%optctl, "e");
|
&GetOptions(\%optctl, "e");
|
||||||
|
|
||||||
&help if $opt_h;
|
&help if $opt_h;
|
||||||
|
|
@ -270,7 +272,8 @@ At the moment it takes the following options:
|
||||||
-e <editor> invoke with this editor; ignored if -f or -p is given
|
-e <editor> invoke with this editor; ignored if -f or -p is given
|
||||||
-p <pattern> use a pattern to edit; ignored if -f is given
|
-p <pattern> use a pattern to edit; ignored if -f is given
|
||||||
-f <file> use a pattern file to edit
|
-f <file> use a pattern file to edit
|
||||||
-v verify/verbose; shows file moves that would happen without -v
|
-v verbose; shows file moves
|
||||||
|
-t test; doesn't move, implies -v
|
||||||
|
|
||||||
Specifying fiels on the command line is still unsafe! There are no checks
|
Specifying fiels on the command line is still unsafe! There are no checks
|
||||||
to prevent overwriting non-specified files!
|
to prevent overwriting non-specified files!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue