I am trying to figure out how to use UNIX shell scripts (sch, to be exact), and am having problems with the foreach statement. The purpose of my first script is to do the following:
1. go into a directory and delete any output files that may be present from a previous run
2. go into a different directory and compile + simulate several different files, and copy their outputs to the directory that was cleaned out in step 1.
The problem I am having is that if the directory in step 1 is empty, my script just stops executing, and doesn't even try step 2. It just finishes and the command line says "foreach: No match."
Why won't it continue on and run the rest of my script?
Here is what I have:
1. go into a directory and delete any output files that may be present from a previous run
2. go into a different directory and compile + simulate several different files, and copy their outputs to the directory that was cleaned out in step 1.
The problem I am having is that if the directory in step 1 is empty, my script just stops executing, and doesn't even try step 2. It just finishes and the command line says "foreach: No match."
Why won't it continue on and run the rest of my script?
Here is what I have: