Skip to content

Commit

Permalink
Fix "warning: regexp escape sequence `\"' is not a known regexp opera…
Browse files Browse the repository at this point in the history
…tor"

Since v5.0.0, awk doesn't treat ``\"` as a regexp operator.
So the current implementation causes the following warning when
using awk >= v5.0.0.

```
awk: cmd. line:1: warning: regexp escape sequence `\"' is not a known regexp operator
```

This PR replaces `\"` to `"` to fix the warning.

Ref: KittyKatt/screenFetch#627
  • Loading branch information
y-yagi committed Dec 18, 2024
1 parent ed921f2 commit 3f905b7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/scripts/notify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,7 @@ SanitizeVars() {
# Escape newlines.
sanitized_value="$(printf '%s' "$sanitized_value" | tr -d '\r' | awk 'NR > 1 { printf("\\n") } { printf("%s", $0) }')"
# Escape double quotes.
if [ "$PLATFORM" = "windows" ]; then
sanitized_value="$(printf '%s' "$sanitized_value" | awk '{gsub(/"/, "\\\""); print $0}')"
else
sanitized_value="$(printf '%s' "$sanitized_value" | awk '{gsub(/\"/, "\\\""); print $0}')"
fi
sanitized_value="$(printf '%s' "$sanitized_value" | awk '{gsub(/"/, "\\\""); print $0}')"

# Write the sanitized value back to the original variable.
# shellcheck disable=SC3045 # This is working on Alpine.
Expand Down

0 comments on commit 3f905b7

Please sign in to comment.