Quoting dramas when using AFNI through in a Container

I am trying to run a 3dDeconvolve command, but I am running it in bash terminal through a containerized AFNI program. It works until I add the bit that specifies the contrast. This portion of the command needs to be passed in with quotes and spaces.

-gltsym ‘SYM: +exc -eq’

Bash is separating it out and the command is failing. Does anyone have any suggestions on how to get around this?

I have tried…

  1. creating a separate variable with the argument and passing in to the command, but this still fails. https://mywiki.wooledge.org/BashFAQ/050
  2. quotes, more quotes around the actual argument
  3. maybe I am missing something here?

The full code is here…

3dDeconvolve \
  -input /work/06953/jes6785/ls6/NECTARY_DATA/derivatives/fmriprep-v22.0.2/sub-b071/ses-01/func/sub-b071_ses01_task-cyb_dir-AP_space-MNI152NLin2009cAsym_desc-preproc_6.0blur+scale.nii \
  -mask /work/06953/jes6785/ls6/NECTARY_DATA/derivatives/fmriprep-v22.0.2/sub-b071/ses-01/func/sub-b071_ses-01_task-soc_dir-AP_space-MNI152NLin2009cAsym_desc-brain_mask.nii.gz \
  -polort A \
  -num_stimts 2 \
  -stim_times_AM1 1 /work2/06953/jes6785/ls6/NECTARY_DATA/derivatives/AFNI_Behavioral_Files/sub_b071/sub_071-1_tf_under_1.1D dmBLOCK\(2\) \
  -stim_label 1 exc \
  -stim_times_AM1 2  /work2/06953/jes6785/ls6/NECTARY_DATA/derivatives/AFNI_Behavioral_Files/sub_b071/sub_071-1_tf_equal_1.1D dmBLOCK\(2\) \
  -stim_label 2 eq \
  -ortvec /work2/06953/jes6785/ls6/NECTARY_DATA/derivatives/Confound_Files/sub_b071/sub_b071_conservative_confounds.txt \
  test \
  -gltsym 'SYM: +exc -eq' \ 
  -glt_label 1 exc \
  -fout -tout \
  -x1D X.xmat.1D \
  -xjpeg 071X.jpg \
  -x1D_uncensored 071X.nocensor.xmat.1D \
  -fitts fitts.071 \
  -errts errtsSYM:exc-eqSYM:1-2.071 \
  -bucket stats.071 

It looks like there is a missing \ at the end of the line with -gltsym 'SYM: +exc -eq'

Sorry, that’s a typo on my part. That was in there. will edit.


I was a bit suspicious of that backslash in the line you refer to, because even in the codeframe of the posted question, the line following it has odd format. So, I copied the full text of your 3dDeconvolve command to a file called “tmp.txt”, and ran that through AFNI’s file_tool to check for bad characters. Indeed, something is awry there:

$ file_tool -infiles tmp.txt -show_bad_all 
tmp.txt has 0 bad characters

tmp.txt file type: UNIX
file 'tmp.txt' has bad backslashes:
   bad '\' line   12 :   -gltsym 'SYM: +exc -eq' \ 
consider: file_tool -show_bad_backslash -infile tmp.txt -prefix FIXED.txt

… and it appears that there is a space after that backslash, which is what the file_tool is complaining about. Having a space to the right of the backslash removes its “continuation of line”-ability.

Can you verify if that solves the issue?


On a separate issue: I don’t think you should have a colon “:” in your output filename—that is, in that -errts .. line. I don’t know that that can be recognized on a filesystem.