If your script hangs, I suspect it is because
/usr/local/fsl/bin/feat hangs (whatever that is).
Observations:
- You are discarding output from the backticks. For debugging purposes (to see if there is output): print `/usr/local/fsl/bin/feat Level1Run1_spec.fsf`;
- cd .. will not change your directory. You need chdir.
- The opendir does not really do anything in your code.
- Customarily, the use lines appear at the top of a script.
- $s=$s+1 is typically written as $s++
- For other tips, refer to the Basic debugging checklist.