What is the Bash Escape Character “\\c”?

為{幸葍}努か 提交于 2019-12-04 01:53:22

That's actually specific to some versions of echo (I'm pretty sure that \c came from SysV while the -n version was a BSD-ism).

It simply means don't output the trailing newline.

See the echo man page or the section on echo in the Bash Builtins section of the Bash manual:

echo interprets the following escape sequences:

...
\c
     suppress further output

It's the 'End of Text' control character; it informs the Shell that the end of text has been reached.

Not entirely sure that it's relevant any more, but I could be wrong.

here's the doc:

http://en.wikipedia.org/wiki/ASCII#ASCII_control_characters

and:

http://en.wikipedia.org/wiki/End-of-text_character

Can you update your question with a little more context on how the \c is being used?

You can use \c to escape control characters that you may, say write to a file, or pipe as input to another command.

This will write to the terminal the text "some command" followed by binary ctrl-d (ascii 0x4):

echo some control string $'\cd' 

See full list of escape characters from the bash man page: http://linux.die.net/man/1/bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!