Hi all,
sorry for reviving this super old thread, but it came up here as well with Freesurfer 6.0.0.
This is an Ubuntu-related error that has surfaced recently because in Ubuntu /bin/sh is not a bash shell any more. To get around this, you can edit the first line of the scripts $FREESURFER_HOME/bin/bedpostx_mgh and $FREESURFER_HOME/bin/fsl_sub_mgh. You'll have to replace "/bin/sh" with "/bin/bash" on the first line of those two scripts.
I believe this is only half the truth. Sure, changing the interpreter to /bin/bash fixes the issue, but underlying assumption is wrong and should be addressed with a future release of Freesurfer I think.
Using bash-syntax in a /bin/sh (posix shell) interpreted script is simply an error and should be fixed by either removing the bashism[1] (arrays in this case) or by explicitly switching to /bin/bash.
[1] http://mywiki.wooledge.org/Bashism
best regards Michael Krause