[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: echo $'\0' >a does not write the nul byte

From: Ilkka Virta
Subject: Re: echo $'\0' >a does not write the nul byte
Date: Mon, 18 Jan 2021 00:21:10 +0200

On Mon, Jan 18, 2021 at 12:02 AM Martin Schulte <gnu@schrader-schulte.de>

> To be exact, this is already caused by a Unix Kernel - strings passed by
> the exex* system calls are null terminated, too. As it is the default in
> the C programming language. Thus you can't pass a null byte in an argument
> when invoking a program.

Bash's echo is a builtin, so using it doesn't involve an execve(). Most
shells still don't allow passing NULs
to builtins. Zsh is the exception, it does allow NUL bytes in internal
variables and in arguments to builtins.
But, that's Zsh, and of course even it can't pass the NUL as an argument to
an external program, exactly
because of the execve() interface.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]