Reputation: 1
attaching my script below as Im trying to run a script to analyze imaging data via freesurfer. I have a group of 39 participants with different anatomical file names (T1w file) that I want to be used both as input folders, and then used to create output folders. Im getting the following error: expr: syntax error: missing argument after '3'
this is a simple bash script - any input would be greatly appreciated!
#!/bin/bash
#SBATCH -c 8 # Number of Cores per Task
#SBATCH --mem=16GB # Requested Memory;increased memory.
#SBATCH -p cpu # Partition; cpu partition is for 24 hours; cpu-long is 30 days
#SBATCH -t 12:00:00 # Job time limit
#SBATCH -o slurm-%A_%a.out #%a= job ID
#SBATCH -e slurm-%A_%a.err #any error output per participant
#SBATCH --array=1-39%39
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --cpus-per-task=8
#SBATCH --time=12:00:00
#SBATCH --mail-type=ALL
#SBATCH [email protected]
export FREESURFER_HOME=/home/iorlovsky_umass_edu/freesurfer
source $FREESURFER_HOME/SetUpFreeSurfer.sh
export SUBJECTS_DIR=/work/pi_rspencer_umass_edu/T1W_Scans
cd $SUBJECTS_DIR
find ~+ -name "*T1w_*.nii" > $SUBJECTS_DIR/nii_filelist
input_file=`sed "${SLURM_ARRAY_TASK_ID}q;d" nii_filelist`
filename=$(basename -- "$input_file")
**idx=`expr substr $filename 1 3` **
recon-all -s EMO${idx} -i $input_file -all -openmp 4
not sure why error but also really poor scripting fluency and very new to this
Upvotes: 0
Views: 57