My Linux is Arch, my configuration is as follows:
Kernel: 5.13.13-arch1-1
Packages: 490 (pacman)
Shell: zsh 5.8
WM: dwm
Terminal: st
Terminal Font: Source Code Pro
When I use C output statements, such as printf
and putchar('A');
, if I don't add \r or \n at the end, I will get an extra '%' character on the terminal.
$ ./a.out
A%
$
This problem has troubled me for a long time, so that I don't know who is the problem, with dwm? With sh? With zhs?
This is a feature of zsh to show when a program has ended without a final newline and to distinguish zsh’s command prompt from the program output.
You can disable it with the zsh command PROMPT_EOL_MARK=''
. You can also set it to something else, such as PROMPT_EOL_MARK=' -- The program did not end with a newline.'
.