-1

This is the error that I receiveI am new to this, and I want to run the following script in shell but I am getting errors, COLUMN.nii file is the nifty file with a collection of masks with value ranging from 1 to 10 and I want to separate these masks into individual nifty file using this AFNI command in a for loop.

Any suggestions are welcomed, thanks K.

for i in {1..10};
    do
    3dcalc -a COLUMNS.nii -expr ‘equals(a, "${i}”)’ -prefix col_"${i}”.nii;
    done
  • The actual *question* is about `bash`, not mask, neuroscience, or neuro-image. http://idownvotedbecau.se/itsnotworking/ - Please c.f. [this page](https://stackoverflow.com/help/asking) for guidelines on asking good questions. (And try `vi`, or even notepad.) ;) – Paul Hodges Jul 06 '20 at 13:25
  • 1
    Thank you, this is my first question ever here, but I will keep this in mind :) – Avinash Kalyani Jul 07 '20 at 12:35

1 Answers1

3

It seems that you may have edited your code using a word processing program, such as Microsoft Word, which doesn't put "normal" single- and double-quote characters into the file.

In your program the line

3dcalc -a COLUMNS.nii -expr ‘equals(a, "${i}”)’ -prefix col_"${i}”.nii;

has those "curly" single- and double-quote characters. Change this to

3dcalc -a COLUMNS.nii -expr 'equals(a, "${i}")' -prefix col_"${i}".nii;

When editing code I recommend that you use a programming-specific editor - there are many out there - rather than a word processing program.