Mornin' --
By using back-ticks, you are running the find command in a sub-shell. The
usual Shell continuation conventions apply. You have to escape the
new-line:
`find $dir_to_search
-name cache -prune \<nl>
-o -name tmp -prune \<nl>
-o -name session -prune \<nl>
-o -print`;
Note: There can be no space between the escape and the new-line character.
Note: Perl provides a find() command so you don't have to shell-out and
confuse the issue
On Thu, Jan 1, 2015 at 1:19 PM, SSC_perl <[email protected]> wrote:
> Is it possible to wrap a `find` command on multiple lines in a
> script? This is what I'm using now:
>
> foreach $dir_to_search (@dirs_to_search) {
> $dir_count--;
> @files = map {
> s|/home/user/public_html ||;
> $_;
> } `find $dir_to_search -name cache -prune -o -name tmp -prune -o
> -name session -prune -o -print`;
>
> I'd like to be able to do something like this to make it more
> readable:
>
> foreach $dir_to_search (@dirs_to_search) {
> $dir_count--;
> @files = map {
> s|/home/user/public_html||;
> $_;
> } `find $dir_to_search
> -name cache -prune
> -o -name tmp -prune
> -o -name session -prune
> -o -print`;
>
> however my searches have turned up nothing. Using returns, commas,
> backslashes, or concatenation breaks the find. Does anyone know if this is
> doable?
>
> Thanks,
> Frank
> SurfShopCART
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> http://learn.perl.org/
>
>
>
--
Bob Goolsby
[email protected]