On Sun, Jan 17, 2021 at 12:05 PM <h...@artax.karlin.mff.cuni.cz> wrote: > (...) > The nul byte is not echoed by $'\0'.
This is expected. Bash uses NUL-byte terminated character sequences to store strings, so it can't actually store NUL bytes themselves. $'\0' is the same as '' (i.e. an empty string). If you want to output an actual NUL byte, try using: printf '\0' Instead