diff --git a/bids_convert.sh b/bids_convert.sh index 6243069..1a1d974 100644 --- a/bids_convert.sh +++ b/bids_convert.sh @@ -1052,7 +1052,7 @@ fixup_run_numbers() { else local run_tag run_tag="run-$(printf '%02d' "$run_num")" - local new_pattern="${pattern%_${suffix}}_${run_tag}_${suffix}" + local new_pattern="${pattern%_"${suffix}"}_${run_tag}_${suffix}" for ext in .nii.gz .json .bval .bvec; do local old="${search_dir}/${pattern}${ext}" diff --git a/tests/test_bids_convert.sh b/tests/test_bids_convert.sh index 3a3e3d2..29cb1b9 100644 --- a/tests/test_bids_convert.sh +++ b/tests/test_bids_convert.sh @@ -95,9 +95,13 @@ test_dry_run_creates_no_files() { # then reports the pipeline as failed even though grep did match. local out out="$(bash "$SCRIPT" -i "$input_dir" -o "$output_dir" -n 2>&1)" || true - echo "$out" | grep -q "DRY-RUN" && \ - echo " ✅ PASS: dry-run mode activated" && { ((PASS++)) || true; } || \ - { echo " ❌ FAIL: dry-run mode not detected"; ((FAIL++)) || true; } + if echo "$out" | grep -q "DRY-RUN"; then + echo " ✅ PASS: dry-run mode activated" + ((PASS++)) || true + else + echo " ❌ FAIL: dry-run mode not detected" + ((FAIL++)) || true + fi teardown_tmp }