Using bash string variables, I am trying to run the following command in a loop after assigning these variables:
c=$((c+1))
opt_string=\"opticsGroup${c}\"
input_files=\"${line}/*.tif\"
And when I echo these variables I get the desired effect:
echo $opt_string
"opticsGroup1"
echo $input_files
"Movies/01_Optic/*.tif"
But when I try to use the variables to execute a command, they get surrounded in single quotes. Is there anyway to escape this behavior? Or might this be a problem of the script I am trying to run in the loop?
relion_import --do_movies --optics_group_name '"opticsGroup1"' --optics_group_mtf ../../../../../Processing/Jacob/MTFs/mtf_k3_300kv_standard.star --angpix 1.06 --kV 300 --Cs 2.7 --Q0 0.1 --beamtilt_x 0 --beamtilt_y 0 --i '"Movies/01_Optic/*.tif"' --odir Import/job001/ --ofile movies.star --pipeline_control Import/job001/
The way I have the script executing is as the following:
relion_import --do_movies --optics_group_name $opt_string --optics_group_mtf ../../../../../Processing/Jacob/MTFs/mtf_k3_300kv_standard.star --angpix 1.06 --kV 300 --Cs 2.7 --Q0 0.1 --beamtilt_x 0 --beamtilt_y 0 --i $input_files --odir Import/job$k/ --ofile movies.star --pipeline_control Import/job$k/
An example of a command that runs properly is:
relion_import --do_movies --optics_group_name "opticsGroup1" --optics_group_mtf mtf_k3_300kv_standard.star --angpix 1.06 --kV 300 --Cs 2.7 --Q0 0.1 --beamtilt_x 0 --beamtilt_y 0 --i "001_Optic/*tif" --odir Import/job001/ --ofile movies.star --continue --pipeline_control Import/job001/