7

Whenever I use printf in the shell whether it is within awk, a standalone application, or in C/C++ it prints a "%" after everything. For instance, when I type printf "hi" I get this as an output hi%. I am on Arch Linux using zsh as a shell and konsole as a terminal emulator. The font I use is MesloLGS NF.

Image:

My Terminal

oguz ismail
  • 1
  • 16
  • 47
  • 69

1 Answers1

14

This is zsh's way of telling you that the preceding command outputted a partial line and the shell terminated that line to give you a prompt on a new line.

You can disable this behavior by typing PROMPT_EOL_MARK='' into the command prompt.

David Schwartz
  • 179,497
  • 17
  • 214
  • 278
  • Thanks for the answer, it helped me recognize my issue, but putting PROMPT_EOL_MARK='' did nothing. – Russell Hynes Jun 09 '20 at 20:08
  • Nevermind, I just can't pass it like PROMPT_EOL_MARK='' {program_name} – Russell Hynes Jun 09 '20 at 20:10
  • @DavidSchwartz: But from the [docs](https://linux.die.net/man/1/zshparam), I would conclude that `PROMPT_EOL_MARK` affects only so-called _partial lines_. This is discussed [here](https://unix.stackexchange.com/questions/167582/why-zsh-ends-a-line-with-a-highlighted-percent-symbol#167600). – user1934428 Jun 10 '20 at 09:58
  • @user1934428 Correct. If you change the command to output a full line, the `%` will disappear. – David Schwartz Jun 10 '20 at 16:57
  • you may add `export PROMPT_EOL_MARK=''` to you ~/.zshrc – Robert Ranjan May 17 '23 at 01:50