Skip to content

Commit 1576691

Browse files
committed
Remove Byte Order Mark (BOM) from cmd outputs
1 parent d21acc2 commit 1576691

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/check_drupal

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ trim_lines() {
7171
echo "${_str}" | grep -v '^$'
7272
}
7373

74+
#
75+
# Remove annoying BOM
76+
#
77+
remove_bom() {
78+
_str="${1}"
79+
echo "${_str}" | sed '1s/^\xEF\xBB\xBF//'
80+
}
81+
82+
7483
# Check for a valid severity and return the
7584
# appropriate nagios exit code
7685
# Allowed values: 'w' or 'e'
@@ -309,6 +318,7 @@ check_core_errors() {
309318
fi
310319

311320
# Trim the string
321+
_core_errors="$(remove_bom "${_core_errors}")"
312322
_core_errors="$(trim_lines "${_core_errors}")"
313323
_core_errors="$(trim "${_core_errors}")"
314324

0 commit comments

Comments
 (0)