Summary
Parameter expansion prefix stripping `${var#pattern}` fails when the pattern concatenates a literal string (`./`) with a quoted variable (`"$prefix"`). The pattern is not matched and the string is returned unchanged.
Reproduction
i="./tag_hello.tmp.html"
prefix_tags="tag_"
# Fails — does not strip:
result=${i#./"$prefix_tags"}
echo "$result"
# Expected: hello.tmp.html
# Actual: ./tag_hello.tmp.html (unchanged!)
# Works — literal pattern:
result=${i#./tag_}
echo "$result"
# Expected: hello.tmp.html
# Actual: hello.tmp.html (correct)
# Works — variable-only pattern:
result=${i#./$prefix_tags}
echo "$result"
# Expected: hello.tmp.html
# Actual: hello.tmp.html (correct)
Real bash comparison
All three forms produce `hello.tmp.html` in real bash.
Context
Bashblog uses this in `rebuild_tags()`:
while IFS='\'' read -r i; do
tagname=${i#./"$prefix_tags"}
tagname=${tagname%.tmp.html}
create_html_page "$i" "$prefix_tags$tagname.html" ...
done < <(ls -t ./"$prefix_tags"*.tmp.html)
When stripping fails, `tagname` becomes `./tag_hello` instead of `hello`, producing invalid filenames like `tag_./tag_hello.html`.
Expected behavior
`${var#./"$other"}` should concatenate the literal `./` with the value of `$other` to form the pattern, then strip it from the beginning of `$var`.
Summary
Parameter expansion prefix stripping `${var#pattern}` fails when the pattern concatenates a literal string (`./`) with a quoted variable (`"$prefix"`). The pattern is not matched and the string is returned unchanged.
Reproduction
Real bash comparison
All three forms produce `hello.tmp.html` in real bash.
Context
Bashblog uses this in `rebuild_tags()`:
When stripping fails, `tagname` becomes `./tag_hello` instead of `hello`, producing invalid filenames like `tag_./tag_hello.html`.
Expected behavior
`${var#./"$other"}` should concatenate the literal `./` with the value of `$other` to form the pattern, then strip it from the beginning of `$var`.