LJ Archive

Listing 1

#!/usr/bin/perl -l
$FIND = "find / -print 2>/dev/null |";
open($FIND, $FIND)  ||  die "Cant open $FIND: $!;
stopped";
while (<$FIND>) {
  chomp;
  next  unless (-f && -x _ && -r _ && -T _);
  $file = $_;
  if (!open($file, $file)) {
    warn "Cant read $file: $!";
    next;
  }
  chomp($firstLine = <$file>);
  close($file);
  printf("%-32s %s\n", $firstLine, $file)
  if ($firstLine =~ m{^\#!/.*sh});
}
close($FIND);
LJ Archive