я пытаюсь напечатать stdin без завершающей новой строки, которая появляется после использования cat, grep, awk и т. д. (Mac OS X zsh) К сожалению, echo -n не работает, он печатает какой-то странный символ.
У вас есть идеи по этому поводу? Спасибо.
я пытаюсь напечатать stdin без завершающей новой строки, которая появляется после использования cat, grep, awk и т. д. (Mac OS X zsh) К сожалению, echo -n не работает, он печатает какой-то странный символ.
У вас есть идеи по этому поводу? Спасибо.
От человека zshoptions:
PROMPT_SP <D>
Attempt to preserve a partial line (i.e. a line that did not end
with a newline) that would otherwise be covered up by the command prompt
due to the PROMPT_CR option. This works by outputting some
cursor-control characters,
including a series of spaces, that should make the terminal wrap to the
next line when a partial line is present (note that this is only
successful if your terminal has automatic margins, which is typical).
When a partial line is preserved, by default you will see an inverse+bold
character at the end of the partial line: a "%" for a normal user or a
"#" for root. If set, the shell parameter PROMPT_EOL_MARK can be used
to customize how the end of partial lines are shown.
NOTE: if the PROMPT_CR option is not set, enabling this option will have
no effect. This option is on by default.
Добавьте это в свой .zshrc, чтобы изменить поведение. И обратите внимание, что это функция по дизайну, а не ошибка.
export PROMPT_EOL_MARK=''