2

If I have a UNIX shell script which has some commands on each line that needs to be run, like

#!/bin/bash
command1
command2

command2 to be excuted only after completion of command1. how to achieve it

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Karunakar
  • 2,209
  • 4
  • 15
  • 20

1 Answers1

2

You've already done it. bash normally waits for each command to run before running the next command. If you end the command with an ampersand (&), then it runs the command in the background, but since you haven't done that, each command runs synchronously.

Adam Rosenfield
  • 390,455
  • 97
  • 512
  • 589