utility
NUL-delimited mock argument logging
Record exact argument boundaries in a private fixture. For a zero-argument call use a guard to avoid a spurious empty record. Never log real secrets. Example uses mock Docker, not its real command semantics.
Formal Syntax & Structure
bash syntaxbash
printf '%s\0' "$@"Return Value
exit status
Record exact argument boundaries in a private fixture. For a zero-argument call use a guard to avoid a spurious empty record. Never log real secrets. Example uses mock Docker, not its real command semantics.
Working Example
Example Snippetbash
mkdir mockcat > mock/docker <<'MOCK'#!/bin/bashprintf '%s\0' "$@" > argv.binprintf 'mock inventory\n'MOCKchmod 700 mock/dockerargs=(ps --filter 'label=team=daily report' --format '{{.Names}}')./mock/docker "${args[@]}" || exit 1mapfile -d '' -t observed < argv.bin[[ ${#observed[@]} == 5 && ${observed[2]} == 'label=team=daily report' && ${observed[4]} == '{{.Names}}' ]] || exit 1printf 'arguments verified\n'