I have found the case (well at least one) where the s/w path is expanded out of $FSLDIR. This is in the feat design.fsf
file. There is a line
set fmri(regstandard) "/usr/local/fsl/4.1/gnu/data/standard/MNI152_T1_2mm_brain"
which has expanded it out. So I have enhanced my script as follows (happy for it to be distributed in
'contributed').
Call with
fixFSLPaths <dir to fix>
and tailor the paths to suit at the bottom of the script
#!/bin/bash
fixPaths ()
{
local rootDir=${1}
local oldPath=${oldPath}
local oldPath2=${oldPath2}
local newPath=${newPath}
# Find all files
find ${rootDir} -type f | while read file ; do
# See if the file is ASCII
ft=`file $file`
if [[ $ft = *ASCII* ]]; then
# Look for known path
y=`grep $oldPath $file`
if [ "$y" ]; then
# Replace path
echo "Fixing " $file
# Double quote to translate variables
sed -i "s#$oldPath2#$newPath#g" $file
fi
fi
done
}
# Do it
echo "Fix data paths"
oldPath="/store/projects/oa_coping/MRI"
oldPath2="\/store\/projects\/oa_coping\/MRI"
newPath="\/home\/nkilleen/data\/MRI"
#
fixPaths $1 ${oldPath} ${oldPath2} ${newPath}
#
echo "Fix software paths"
oldPath="/usr/local/fsl/4.1/gnu"
oldPath2="\/usr\/local\/fsl\/4.1\/gnu"
newPath="\/usr\/local\/fsl\/4.1"
fixPaths $1 ${oldPath} ${oldPath2} ${newPath}
|