What is the name and function of the \c
escape character in Bash? What is its numeric value? I have seen that \cx
is a control character, but what about plain \c
? It seems that:
echo -e "Hello World\c"
and
echo -en "Hello World"
are equivalent. However, Python doesn't use it as an escape character, and it is missing from all of the lists of escape characters I found. Is this a Bash-specific behavior?
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):
See full list of escape characters from the bash man page: http://linux.die.net/man/1/bash
See the echo man page or the section on echo in the Bash Builtins section of the Bash manual:
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.