bash scripting: eval and waiting for processes in background

Loïc Grenié loic.grenie at
Thu Feb 25 15:30:47 UTC 2010

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
    "$script" &

   instead ? I confess I do not understand why your master script
  works at all.



More information about the ubuntu-users mailing list