Você também precisa retirar a frente de $dir
com dir=GPS${dir#*GPS}
.
O script resultante:
$ ls
121123_SN323_A_L002_GPS-100_R1.fastq.gz
121123_SN323_A_L002_GPS-100_R2.fastq.gz
121123_SN323_A_L002_GPS-104_R1.fastq.gz
121123_SN323_A_L002_GPS-104_R2.fastq.gz
130201_SN132_B_L007_GPS-100_R1.fastq.gz
130201_SN132_B_L007_GPS-100_R2.fastq.gz
130201_SN132_B_L007_GPS-104_R1.fastq.gz
130201_SN132_B_L007_GPS-104_R2.fastq.gz
$ for a in *.fastq.gz
do
dir=${a%_R*}
dir=GPS${dir#*_GPS}
mkdir -- "$dir" 2>/dev/null
mv -i "./$a" "$dir/"
done
$ ls
GPS-100/ GPS-104/
$ ls *
GPS-100:
121123_SN323_A_L002_GPS-100_R1.fastq.gz
121123_SN323_A_L002_GPS-100_R2.fastq.gz
130201_SN132_B_L007_GPS-100_R1.fastq.gz
130201_SN132_B_L007_GPS-100_R2.fastq.gz
GPS-104:
121123_SN323_A_L002_GPS-104_R1.fastq.gz
121123_SN323_A_L002_GPS-104_R2.fastq.gz
130201_SN132_B_L007_GPS-104_R1.fastq.gz
130201_SN132_B_L007_GPS-104_R2.fastq.gz