Skip to main content
edited body
Source Link
Edward Falk
  • 2.1k
  • 16
  • 15

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do {( cd $path/$folder; $script; }) & done wait done 

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do { cd $path/$folder; $script; } & done wait done 

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do ( cd $path/$folder; $script; ) & done wait done 
added 1 character in body
Source Link
Edward Falk
  • 2.1k
  • 16
  • 15

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do { cd $path/$folder; $script$script; } & done wait done 

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do { cd $path/$folder; $script } & done wait done 

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do { cd $path/$folder; $script; } & done wait done 
Source Link
Edward Falk
  • 2.1k
  • 16
  • 15

The '&' places your sub-scripts into the background, which is why they're all running at the same time.

What you probably want to do is invert your loops:

for script in script1 script2 script3 …; do for folder in $(cat $path/names.txt); do { cd $path/$folder; $script } & done wait done