Skip to content

Portability Notes

Stephen J. Kiernan edited this page Apr 21, 2026 · 1 revision

Portability Notes

portable-hexdump is designed for maximum portability across Unix-like systems.

Supported Shells

The script has been tested and verified to work with the following shells:

  • sh: Traditional Bourne shell and its variants.
  • dash: The Debian Almquist Shell (minimalist and fast).
  • bash: Bourne Again Shell.
  • zsh: Z shell.
  • ksh: Korn shell.

Required Utilities

The script relies only on the following standard POSIX utilities:

  1. sed: Used for parsing documentation and internal string manipulation.
  2. tr: Used to translate null bytes and newlines for safe shell variable handling.
  3. dd: Used for precise byte-by-byte reading and offset skipping.
  4. printf: Used for formatted hex and ASCII output.

Design Philosophy

To remain functional in rescue shells (like those found in initramfs or recovery partitions), the script avoids:

  • Bash-isms: No arrays, no [[ ]] tests, and no non-standard parameter expansions.
  • Gnu-isms: No reliance on GNU-specific extensions to sed or tr.
  • External Tools: No reliance on od, xxd, or awk.

Known Limitations

  • File Arguments: Currently, the tool only reads from stdin. File arguments are planned for a future release.
  • Performance: Since the tool reads input byte-by-byte using dd to ensure POSIX compliance without complex buffer logic, it is significantly slower than native C implementations like xxd. It is intended as a survival tool, not a high-volume data processor.

Clone this wiki locally