Skip to content

Commit 8573bf6

Browse files
committed
fix: run number parsing
1 parent 4cd3edb commit 8573bf6

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

bin/qtl-histogram

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ declare -A runnumHash # `rdirs` element -> run number
300300
for rdir in ${rdirs[@]}; do
301301
# get the run number, either from `rdir` basename (fast), or from `RUN::config` (slow)
302302
[[ ! -e $rdir ]] && printError "the run file/directory '$rdir' does not exist" && continue
303-
runnum=$(basename $rdir | grep -m1 -o -E "[0-9]+" || echo '') # first, try from run directory (or file) basename
303+
runnum=$(basename $rdir | grep -m1 -o -E "[0-9]+" | tail -n1 || echo '') # first, try from run directory (or file) basename
304304
if [ -z "$runnum" ] || ${modes['swifjob']}; then # otherwise, use RUN::config from a HIPO file (NOTE: assumes all HIPO files have the same run number)
305305
if ${modes['flatdir']}; then
306306
$TIMELINESRC/libexec/hipo-check.sh $rdir
@@ -313,7 +313,8 @@ for rdir in ${rdirs[@]}; do
313313
runnum=$($TIMELINESRC/libexec/run-groovy-timeline.sh $TIMELINESRC/libexec/get-run-number.groovy $firstHipo | tail -n1 | grep -m1 -o -E "[0-9]+" || echo '')
314314
fi
315315
fi
316-
[ -z "$runnum" -o $runnum -eq 0 ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
316+
[ -z "$runnum" ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
317+
[ $runnum -eq 0 ] && printError "unknown run number for '$rdir'; ignoring it!" && continue
317318
runnum=$((10#$runnum))
318319
runnumHash[$rdir]=$runnum
319320
done

0 commit comments

Comments
 (0)