diff --git a/scripts/embed.sh b/scripts/embed.sh
index 1f57b8741a925d4e58e54f8a838ccd9292a1bfdc..043e74afd65573172985a9f8b23e77793c40ed8b 100755
--- a/scripts/embed.sh
+++ b/scripts/embed.sh
@@ -1,8 +1,9 @@
 #!/bin/sh
 set -e
 alias strip="sed -e 's/^[    ]*//g; s/[ ][ ]*/ /g; /^--/d; /^$/d'"
-if hash xxd 2>/dev/null; then
+if command -v xxd > /dev/null 2>&1; then
 	xxd -i - < $1 | strip
 else
 	hexdump -v -e '/1 "0x%02X, " " "' < $1 | strip
 fi
+exit $?