help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] bash beginner


From: Greg Wooledge
Subject: Re: [Help-bash] bash beginner
Date: Fri, 11 May 2012 14:29:32 -0400
User-agent: Mutt/1.4.2.3i

On Fri, May 11, 2012 at 02:13:29PM -0400, DJ Mills wrote:
> Or if it needs to be truly recursive, find.
> 
> while IFS= read -rd '' f; do
>   autodock -p "$file" "${file%.dpf}.dlg
> done < <(find . -type f -name '*.dpf' -print0)

You meant:

while IFS= read -rd '' file; do
  autodock4 -p "$file" -l "${file%.dpf}.dlg"
done < <(find . -type f -name '*.dpf' -print0)

And that's assuming you don't actually need to 'cd' first (e.g.  because
there is some second file that it reads from $PWD, or who knows what).

Although I'd probably write it this way:

find . -type f -name '*.dpf' -exec bash -c '
  for file; do autodock4 -p "$file" -l "${file%.dpf}.dlg"; done
' _ {} +

assuming your version of find has -exec +, plus all the other assumptions
made so far.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]