How to run multiple script files in a sequence on OS X?

10,232

You just call each script as you would before, but seperate them with a semicolon ;

After each script finishes execution, bash will start executing the next script.

In the terminal:

./scriptsrc/script_1; ./scriptsrc/script_2; ./scriptsrc/script_n;

If you need more guidance check this question out, its fairly similar.

EDIT: If you want to run multiple scripts from one other script this can be accomplished by adding the shebang line to tell the kernel the file is executable and then just listing what scripts you want:

#!/bin/bash

./scriptsrc/script_1 
./scriptsrc/script_2
./scriptsrc/script_n

echo "script execution complete"
Share:
10,232
Mian Asbat Ahmad
Author by

Mian Asbat Ahmad

PhD Computer Science from University of York, UK Currently I am working as Senior Research Associate DevOps in Department of Medical Physics and Biomedical Engineering, University College London. Prior to that I was Bioinformatician and Systems Administrator in Royal Brompton and Harefield Trust NHS Hospital (October 2016 to October 2018) Research Associate in Machine Learning and Data Mining in Imperial College London (2015-2016)

Updated on June 05, 2022

Comments

  • Mian Asbat Ahmad
    Mian Asbat Ahmad almost 2 years

    I have 10 script files and each file contain up to 100 commands ( each command take 1 min ). At the moment it saves me time and I click only one file to execute 100 commands but what I want is another script file which execute 10 script files sequentially instead of me waiting for each to finish and then executing the second script file by clicking it.