Skip to content

Commit

Permalink
Merge pull request Deep-MI#511 from Deep-MI/fix/older-bash-srun-fasts…
Browse files Browse the repository at this point in the history
…urfer

Remove strings from arithmetic expressions
  • Loading branch information
m-reuter committed Apr 16, 2024
2 parents 4e76bed + 5aa851b commit e39feeb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions brun_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ then
done
echo ""
echo ""
echo "Running in shell$(ls -l "/proc/$$/exe" | cut -d">" -f2)"
shell=$(ls -l "/proc/$$/exe" | cut -d">" -f2)
echo "Running in shell $shell: $($shell --version 2>/dev/null | head -n 1)"
echo ""
echo "---END DEBUG ---"
fi
Expand Down Expand Up @@ -318,18 +319,19 @@ then
fi
fi

num_subjects=${#subjects[@]}
if [[ -z "$task_id" ]] && [[ -z "$task_count" ]]
then
subject_start=0
subject_end="${#subjects[@]}"
subject_end=$num_subjects
elif [[ -z "$task_id" ]] || [[ -z "$task_count" ]]
then
echo "Both task_id and task_count have to be defined, invalid --batch argument?"
exit 1
else
subject_start=$(((task_id - 1) * "${#subjects[@]}" / task_count))
subject_end=$((task_id * "${#subjects[@]}" / task_count))
subject_end=$((subject_end < "${#subjects[@]}" ? subject_end : "${#subjects[@]}"))
subject_start=$(((task_id - 1) * num_subjects / task_count))
subject_end=$((task_id * num_subjects / task_count))
subject_end=$((subject_end < num_subjects ? subject_end : num_subjects))
echo "Processing subjects $subject_start to $subject_end"
fi
subject_len=$((subject_end - subject_start))
Expand Down Expand Up @@ -488,4 +490,4 @@ then
fi

# always exit successful
exit 0
exit 0
3 changes: 2 additions & 1 deletion srun_fastsurfer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ do
else debugf " %s" "$p";
fi
done
debug "Running in$(ls -l /proc/$$/exe | cut -d">" -f2)"
shell=$(ls -l "/proc/$$/exe" | cut -d">" -f2)
debug "Running in shell $shell: $($shell --version 2>/dev/null | head -n 1)"
debug ""

if [[ "${pattern/#\/}" != "$pattern" ]]
Expand Down

0 comments on commit e39feeb

Please sign in to comment.