Hi guys and girls!
I have a huge problem, but overcoming it could simplify my whole work.
I have to perform some task and I know it could be done much more easier, but as I was educated in a Windows based environment and I do not know OS X as well as Windows or DOS.
So, here it goes.
I have to create a batch file equivalent in OS X that performs the following tasks. The commands are executed in a terminal window. These perform mathematical operations with cortical brain masks and overwrite the source files as they are not needed anymore:
fslmaths R_S1.nii.gz -sub R_M1.niigz -bin R_S1.nii.gz
fslmaths R_M1.nii.gz -add R_S1.nii.gz mix
fslmaths R_Premotor.nii.gz -sub mix.nii.gz -bin R_Premotor.nii.gz
fslmaths R_Premotor.nii.gz -add mix.nii.gz mix
fslmaths R_frontal_lobe.nii.gz -sub mix.nii.gz -bin R_frontal_lobe.nii.gz
fslmaths R_frontal_lobe.nii.gz -add mix.nii.gz mix
fslmaths R_temporal_lobe.nii.gz -sub mix.nii.gz -bin R_temporal_lobe.nii.gz
fslmaths R_temporal_lobe.nii.gz -add mix.nii.gz mix
fslmaths R_occipital_lobe.nii.gz -sub mix.nii.gz -bin R_occipital_lobe.nii.gz
fslmaths R_occipital_lobe.nii.gz -add mix.nii.gz mix
fslmaths R_parietal_lobe.nii.gz -sub mix.nii.gz -bin R_parietal_lobe.nii.gz
How to create this file and after inserting the "batch" file in a given folder can it be executed folder specifically?
Thank you for your help and please forgive my noobness
Best Answer Eric , 20 January 2014 - 13:53
You need a shell script. Just put those commands in a text file and put
#!/bin/shon the first line of it. After setting execute permissions as vitorio mentioned you should be able to run it as if it was a command either from a terminal or the GUI. Go to the full post