bash scripting: eval and waiting for processes in background

Amedee Van Gasse (ub) amedee-ubuntu at
Thu Feb 25 15:55:27 UTC 2010

On Thu, February 25, 2010 16:30, Loïc Grenié wrote:
> 2010/2/25 Amedee Van Gasse (ub) <amedee-ubuntu at>:
>> Hi,
>> I have a directory with some scripts with similar names, that I would
>> like
>> to run. I would like to run them all from another script, without having
>> to specify their individual names. Because in the future I may add other
>> scripts, and then I don't have to change the master script.
>> I tried this:
>> SCRIPTS=`ls /root/bin/hotcopy-*.sh`
>> eval "$SCRIPTS" &
>> wait
>> echo "Continue master script."
>      I'm a little bit surprised. Why don't you do something similar to:
> for script in /root/bin/hotcopy-*.sh
> do
>     "$script" &
> done
> wait
>    instead ? I confess I do not understand why your master script
>   works at all.

I did that first, but I must have made a typo somewhere, because that
didn't work at all.
Now it works. Thanks all!


More information about the ubuntu-users mailing list