in reply to Re: Unix shell ls vs readdir
in thread Unix shell ls vs readdir
Do you mean use it like this?
#!/usr/bin/perl -w use strict; use warnings; use File::Find; my @inits; sub wanted { if (-l $_ && (readlink("$_") =~ /tomcat/)) { push @inits, $_ ; } } find(\&wanted, '/etc/rc.d/init.d'); print join("\n", @inits);
I'm not really seeing what I'm gaining (aside from exposure to a very useful module). It seems like overkill, and I can't determine how to prevent it from recursively going into any subdirectories. The $options{'bydepth'} doesn't seem to do that from what I can understand of the docs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Unix shell ls vs readdir
by Anonymous Monk on May 11, 2010 at 14:42 UTC |