...
Set up your folders so every subject has the same folder structure. Basically, this script will just replace your subject name ‘FTD001’ and repeat the same command while only changing the subject name ‘FTD001’ for each subject. So you need to make sure your subjects are in same path, e.g. /path/to/folder/FTD####.
Create a .pbs file, replacing the subject (e.g. FTD001) with ${sub}
...