[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] bash beginner
From: |
DJ Mills |
Subject: |
Re: [Help-bash] bash beginner |
Date: |
Fri, 11 May 2012 14:13:29 -0400 |
On Fri, May 11, 2012 at 1:54 PM, Greg Wooledge <address@hidden> wrote:
> On Fri, May 11, 2012 at 11:47:51AM -0500, Muriel Diaz wrote:
>> I want to execute a line comand (autodock4 -p flename.dpf -l filename.dlg)
>> in many folders in a directory. is It posibble?. the line
>> comand corresponds to a program called autodock. The name of file .dpf
>> (input file) varies in each folder of the directory. The file .dlg is the
>> output file. How can I do it?
>
> Some assumptions have to be made here, because it's not all clear.
>
> Is there precisely *one* .dpf file per directory? With unknown name?
> And do you want the output file to have the same name, except for the
> .dlg suffix? And it's just a single level of subdirectories, not
> fully recursive?
>
> for dir in */; do
> ( cd "$dir" || exit; file=(*.dpf); output=${file%.dpf}.dlg;
> autodock4 -p "$file" -l "$output" )
> done
>
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)