Skip to content

Commit

Permalink
$catdst always needs a value
Browse files Browse the repository at this point in the history
  • Loading branch information
briandfoy committed Jul 5, 2023
1 parent 7803a4c commit f7f4542
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/cp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ sub run {
require File::Copy;
my $err = 0;
foreach my $source (@files) {
my $catdst = catfile( $destination, basename($source) ) if -d $destination;
my $catdst = $destination;
if( -d $destination ) {
$catdst = catfile( $destination, basename($source) )
}

print { output_fh() } "$source -> $catdst\n" if $opts->{v};
if( -e $catdst and $opts->{i} and ! $opts->{f} ) {
my $answer = prompt( "overwrite $catdst? (y/n [n])", 'n' );
Expand Down

0 comments on commit f7f4542

Please sign in to comment.