In the shell of the script below, I would like to run 2 commands in parallel in the background to speed up the process, wait for them to complete and continue to execute a few more commands.
How do I use the same variable name (DATASERVERNAME) in both loops, will these variables interfere with each other in the background? Should I use different variable names, for example DATASERVERNAME_SYBASE, DATASERVERNAME_ORACLE in each cycle?
#!/bin/bash
while read DATASERVERNAME
do
some commands here
done < sybase_data_servers.txt &
while read DATASERVERNAME
do
some commands here
done < oracle_data_servers.txt &
wait
some more commands here
source
share