본문 바로가기

Linux

Run multiple shell scripts in different folders sequentially

반응형

(1) Let's say we have the folder structure like

 

Parent
      |--- Child0

      |--- Child1

 

and each Sub-folder (Child) has a shell script file 'Run_Child.sh'.

 

 

 

(2) Then, create a schell script file 'Run_Parent.sh' and write the following commands

 

for d in 0 1; 
do
  cd "Child$d" && sh Run_Child.sh; cd ../
done

 

Run_Parent.sh should be placed at Parent folder.

 

 

 

 

(3) Finally, run the script like

 

~/Parent$ sh Run_Parent.sh

 

'Linux' 카테고리의 다른 글

nvidia-docker-container installation on Ubuntu  (1) 2025.06.19
at 사용법  (0) 2023.08.17
execution time scheduler 'at'  (0) 2023.06.23
Draw HSV color wheel  (0) 2023.05.15
CUDA Installation error, NVIDIA-drm in use  (0) 2023.05.03