From f4308aa39433c1a798976edcae55ff8466baa699 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 29 May 2026 00:13:07 +0200 Subject: [PATCH] bin/shell-replace --- bin/shell-replace | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bin/shell-replace b/bin/shell-replace index 52810add..0fda7f41 100755 --- a/bin/shell-replace +++ b/bin/shell-replace @@ -31,7 +31,6 @@ my $DEBUG = $main::DEBUG = 0; my %Opt = ( ); get_options(\%Opt); -#help() unless @ARGV; $main::_DATA_ = undef; $Opt{find} = 1 if $Opt{'find-only'}; $Opt{extension} =~ s/^\.// if $Opt{extension}; @@ -47,7 +46,7 @@ use File::Copy; use File::Find; no warnings 'File::Find'; -@ARGV = grep {&file_readable($_)} @ARGV if @ARGV; +@ARGV = grep {file_readable($_)} @ARGV if @ARGV; if (!@ARGV and !-t STDIN) { die "$NAME: option `find` does not work with STDIN!\n" if $Opt{find}; @ARGV = "-"; @@ -97,14 +96,14 @@ for $file (@ARGV) { verbose(1,"Processing $file"); - my @lines = &shell_replace($hfile); + my @lines = shell_replace($hfile); close $hfile; if ( join('',@original) ne join('',@lines) ) { verbose(1,"Change detected in $file"); verbose(2,'Lines: '.@lines.'/'.@original); - #&shell_replace_write($file,@lines) if !$is_stdin and !$DEBUG; + #shell_replace_write($file,@lines) if !$is_stdin and !$DEBUG; # Write changes if (!$is_stdin and !$DEBUG) { @@ -164,13 +163,14 @@ sub file_readable { } return 1; } + sub wanted { my $file = $File::Find::name; - &file_readable($file) or return; + file_readable($file) or return; #warn "$file ".(-r $file ? "YES" : "NO"); # Dont want the myself - return if &myself($file); + return if myself($file); my $hfile; open($hfile,"<","$file"); @@ -249,7 +249,7 @@ sub shell_replace { $cmd = $2; push @lines, $line; #die $cmd; - push @lines, map{s/^/$blank/;$_} &cmd($cmd); + push @lines, map{s/^/$blank/;$_} cmd($cmd); } elsif ($line =~ /^\s*.{1,3}; } else { -- 2.47.3