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
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
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.