#!/usr/bin/env bash set -e # parse command line arguments for i in "$@"; do case $i in -h|--help) echo $helptext exit 0 ;; *) extra_opts="$extra_opts $i" shift ;; esac done # make sure FREESURFER_HOME is set if [[ -z "$FREESURFER_HOME" ]]; then echo "error: FREESURFER_HOME must be set" exit 1 fi # figure out where we want to install the data if [[ -z "$TUTORIAL_DATA" ]]; then TUTORIAL_DATA=$FREESURFER_HOME/subjects/tutorial_data fi mkdir -p $TUTORIAL_DATA # begin download echo "Tutorial data will be downloaded into:" echo " $TUTORIAL_DATA" read -p "Is this correct? [y/n] " if ! [[ $REPLY =~ ^[Yy]$ ]]; then echo "Aborting..." exit 1 fi rsync -ztrlv rsync://surfer.nmr.mgh.harvard.edu/pub/data/tutorial_data/ $TUTORIAL_DATA $extra_opts echo echo "Tutorial data succesfully downloaded"