[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
echo $'\0' >a does not write the nul byte
From: |
hans |
Subject: |
echo $'\0' >a does not write the nul byte |
Date: |
Sun, 17 Jan 2021 21:05:44 +0100 (CET) |
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../bash -I../bash/include -I../bash/lib
-D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -Wall
uname output: Linux artax 3.2.0-4-amd64 #1 SMP Debian 3.2.96-2 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.2
Patch Level: 37
Release Status: release
Description:
Command
echo $'\0' |od -c
writes
0000000 \n
0000001
in contrast to
echo $'\1' |od -c
0000000 001 \n
0000002
The nul byte is not echoed by $'\0'.
Repeat-By:
echo $'\0' |od -c
echo $'\1' |od -c