I would like a bash script to run a program (taking several variables and an input file) in the background, but I want the script to only process one input file (all input files in one directory) at a time. e.g.

```
#!/bin/sh  
for file in *  
do  
    ~/FrameDP/bin/FrameDP.pl --cfg ~/FrameDP/cfg/FrameDP.cfg --no_train --infile /home/bop08olp/FrameDP/data/"$file" --outdir ~/FrameDP/test  
done

```

I'm guessing the above script is not going to wait between each processing of separate input files, but will just start them all at once. The program generates lots of child processes. Any pointers appreciated. Thanks!