Hi-
I guess there might be some spaces in the output when using `...`? Not sure.
This worked for me to build a list of indices (in tcsh, but the syntax should transfer directly to bash):
#!/bin/tcsh
set FILE = STATS_DSET
set idx_list = ( ) # to be populated
# make a list of all the labels
set all_labels = `3dinfo -label "${FILE}" | tr '|' '\n' | grep Coef`
# go through the labels and populate list of indices
foreach label ( ${all_labels} )
set idx_list = ( ${idx_list} `3dinfo -label2index "${label}" "${FILE}"` )
end
echo ""
echo "++ All my labels:"
echo " ${all_labels}"
echo "++ My final index list:"
echo " ${idx_list}"