Skip to content

Commit

Permalink
find alternatives to xxd to check BOM header
Browse files Browse the repository at this point in the history
  • Loading branch information
dsdashun committed Jan 29, 2023
1 parent 9749703 commit a20905f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions br/tests/lightning_bom_file/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ printf '\xEF\xBB\xBF' | cat - <( sed '1s/^\xEF\xBB\xBF//' "${original_schema_fil
printf '\xEF\xBB\xBF' | cat - <( sed '1s/^\xEF\xBB\xBF//' "${original_data_file}" ) > "${data_file}"

# verify the BOM header
if ! [[ $(xxd -p "${schema_file}" | head -c 6 ) == "efbbbf" ]]; then
if ! grep -q $'^\xEF\xBB\xBF' "${schema_file}"; then
echo "schema file doesn't contain the BOM header" >&2
exit 1
fi

if ! [[ $(xxd -p "${data_file}" | head -c 6 ) == "efbbbf" ]]; then
if ! grep -q $'^\xEF\xBB\xBF' "${data_file}"; then
echo "data file doesn't contain the BOM header" >&2
exit 1
fi
Expand Down

0 comments on commit a20905f

Please sign in to comment.