Skip to content

Commit 9c5c61c

Browse files
committed
use POSIX-compatible sed syntax for Alpine
1 parent f08c9d7 commit 9c5c61c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

validators/bash/validate.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ fi
2727
strip_comments() {
2828
# Remove carriage returns (Windows line endings), single-line comments, and multi-line comments
2929
# Also remove trailing commas before } or ] (valid in JSONC, invalid in JSON)
30-
cat "$1" | tr -d '\r' | sed -e 's|//.*$||g' -e ':a;s|/\*.*\*/||g;ta' -e '/\/\*/,/\*\//d' | sed -e 's/,\s*}/}/g' -e 's/,\s*]/]/g'
30+
# Uses POSIX-compatible sed syntax for portability (works with busybox sed)
31+
cat "$1" | tr -d '\r' | sed 's|//.*$||g' | sed 's|/\*[^*]*\*/||g' | sed 's/,[ ]*}/}/g' | sed 's/,[ ]*]/]/g'
3132
}
3233

3334
# Validate URI format

0 commit comments

Comments
 (0)