Variables in shell script

I need help passing variables into my fiji script through an shell script. I currently have this:

#!/bin/bash

module load java

~/Fiji.app/ImageJ-linux64 --headless --run /company/dept/bio/files/johnsmith/imageanalysis/image_proc.ijm “IMAGEDIR=’/company/dept/bio/files/johnsmith/imageanalysis/6292020_3/exp_1/expimages/’” “OUTPUTDIR=’/company/dept/bio/files/johnsmith/imageanalysis/6292020_3/exp_1/expoutput/’”

However, I am getting this error when I run it on the terminal:
Unsupported format or file not found:
OUTPUTDIR=’/company/dept/bio/files/johnsmith/imageanalysis/6292020_3/exp_1/expoutput/’

How do I change my sh file so that it recognizes the commands? Do I have to change anything in my actual fiji script other than commenting out of the outputdir and imagedir defintions?

Hi @slis,

I’m not an expert, since I don’t do this much but here are some things to try. First check out this page if you haven’t already:


it has some of the documentation and examples for what you’re doing.

In short, I think you need all of the IMAGEDIR=... AND OUTPUTDIR=... stuff inside one set of parenthesis, at least thats how the example here looks.

So for example:

~/Fiji.app/ImageJ-linux64 --headless --run /company/dept/bio/files/johnsmith/imageanalysis/image_proc.ijm 'IMAGEDIR=/company/dept/bio/files/johnsmith/imageanalysis/6292020_3/exp_1/expimages/ OUTPUTDIR=/company/dept/bio/files/johnsmith/imageanalysis/6292020_3/exp_1/expoutput/'

where you’ll see the 'IMAGEDIR=... OUTPUTDIR=...' are in one set of single-quotes.

That example also uses --headless --console -macro <script> instead of --headless -run, so I’d try that too.

If those ideas don’t solve your issue, consider posting your macro as well, since seeing that could help us debug with you.

John