Force shell script to run tasks in sequence

I’m running a shell scripts that executes several tasks. The thing is that the script does not wait for a task to end before starting the next one. My script should work differently, waiting for one task to be completed before the next one to start. Is there a way to do that? My script looks like this

sbatch retr.sc 19860101 19860630
scp EN/EN1986* myhostname@myhost.it:/storage/myhostname/MetFiles

the first command runs retr.sc, that retrieves files and it takes half an hour roughly. The second command, though, is run right soon, moving just some files to destination. I wish the scp command to be run only when the first is complete.

thanks in advance


Source: shell

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.