bash scripting: eval and waiting for processes in background
Smoot Carl-Mitchell
smoot at tic.com
Thu Feb 25 15:34:02 UTC 2010
On Thu, 2010-02-25 at 16:18 +0100, Amedee Van Gasse (ub) wrote:
> 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."
>
> Works great, except for one little detail.
> I added echo lines at the start and end of each script for debugging
> purpose. Because the & moves the process to the background, I expected to
> see the following output:
Put the eval in a loop. Something like:
for script in $SCRIPTS; do
eval $script &
done
wait
--
Smoot Carl-Mitchell
Computer Systems and
Network Consultant
smoot at tic.com
+1 480 922 7313
cell: +1 602 421 9005
More information about the ubuntu-users
mailing list