A utility to mark and operate on files in the shell.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
552 B

  1. #!/usr/bin/env perl
  2. =pod
  3. =head1 NAME
  4. marks-each - execute some command for each marked file
  5. =head1 SYNOPSIS
  6. marks-each execute a command for each marked file
  7. USAGE:
  8. marks each command
  9. EXAMPLE:
  10. marks foo.txt bar.txt
  11. marks each wc -l
  12. =head1 AUTHOR
  13. Brennen Bearnes
  14. =cut
  15. use strict;
  16. use warnings;
  17. use 5.10.0;
  18. use App::MarkFiles qw(each_path);
  19. use Pod::Usage;
  20. if ( $ARGV[0] =~ m/^(-h|--help)$/ ) {
  21. shift @ARGV;
  22. pod2usage(0);
  23. }
  24. my ($cmd) = join ' ', @ARGV;
  25. each_path(sub {
  26. my ($path) = @_;
  27. print `$cmd "$path"`;
  28. });