3

I'm new to Ubuntu and command line scripts and wondering how to write a script that runs / automates a series of steps. For example, a script that does the below steps. I could save it as "doeverything.sh" and put it in my user root.

  1. sudo -s in & enter password
  2. cd into /x/y/z directory
  3. run ./script1.sh
  4. wait until done
  5. run ./script2.sh
  6. wait until done
  7. npm start
Kirk Ross
  • 6,413
  • 13
  • 61
  • 104

1 Answers1

3

Maybe try this

#!/bin/bash
cd /x/y/z
bash ./script1.sh #Should run synchronously, won't continue until script1 is finished 
bash ./script2.sh
npm start

Make sure you chmod +x doeverything.sh Then run it with ./doeverything.sh

Brandon Martin
  • 138
  • 1
  • 9