Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 在Mac OS X zsh上打印后删除拖尾新行_Macos_Shell_Line_Trailing - Fatal编程技术网

Macos 在Mac OS X zsh上打印后删除拖尾新行

Macos 在Mac OS X zsh上打印后删除拖尾新行,macos,shell,line,trailing,Macos,Shell,Line,Trailing,我正在尝试打印stdin,但没有在使用cat、grep、awk等之后出现的尾随新行(macosxzsh) 不幸的是,echo-n不起作用,它打印出一些奇怪的字符 你对这件事有什么想法吗? 谢谢。来自man zshoptions: PROMPT_SP <D> Attempt to preserve a partial line (i.e. a line that did not end with a newline) t

我正在尝试打印stdin,但没有在使用cat、grep、awk等之后出现的尾随新行(macosxzsh) 不幸的是,echo-n不起作用,它打印出一些奇怪的字符

你对这件事有什么想法吗? 谢谢。

来自man 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.
PROMPT\u SP
尝试保留部分行(即未结束的行
使用换行符),否则会被命令提示符覆盖
由于提示_CR选项。这是通过输出一些
光标控制字符,
包括一系列空格,这些空格应使端子环绕到
出现部分行时的下一行(请注意,这只是
如果终端具有自动边距(这是典型的),则成功)。
保留部分线时,默认情况下,您将看到反方向+粗体
部分行末尾的字符:普通用户的“%”或
“#”代表根。如果已设置,则可以使用外壳参数提示符\u下线\u标记
自定义局部线条末端的显示方式。
注意:如果未设置提示\u CR选项,则启用此选项将有
没有效果。默认情况下,此选项处于启用状态。
将此项添加到.zshrc以更改行为。请注意,这是一个设计上的特性,而不是一个bug

export PROMPT\u EOL\u MARK=''