Skip to content

Commit

Permalink
Update addMessage.sh: Bug fix: escape &
Browse files Browse the repository at this point in the history
  • Loading branch information
EricClaeys authored Dec 23, 2023
1 parent c179a4a commit 4d11e80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/addMessage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ TAB="$(echo -e "\t")"
# Convert newlines to HTML breaks.
MESSAGE="$( echo -en "${MESSAGE}" |
awk 'BEGIN { l=0; } { if (++l > 1) printf("<br>"); printf("%s", $0); }' )"
MESSAGE="${MESSAGE// /&nbsp;&nbsp;}"
MESSAGE="${MESSAGE// /\&nbsp;\&nbsp;}"

# Messages may have "/" in them so we can't use that to search in sed,
# so use "%" instead, but because it could be in a message (although unlikely),
# convert all "%" to the ASCII code.
# The pound sign in escaped only to make gvim look nicer.
MESSAGE="${MESSAGE//%/&\#37;}"
MESSAGE="${MESSAGE//%/\&\#37;}"

# If ${MESSAGE} contains "*" it hoses up the grep and sed regular expression, so escape it.
ESCAPED_MESSAGE="${MESSAGE//\*/\\*}"
Expand Down

0 comments on commit 4d11e80

Please sign in to comment.