What is the literal for cntrl+c (like ^[ is a lite

2019-09-25 16:11发布

问题:

What is the literal for cntrl+c - kill process (like ^[ is a literal escape). I need to code this literal in here document of one of shell script to get exit the control.

SOme one please help me.. :(

回答1:

The ASCII code for ctrl-C is 3; it is often represented as ^C but this is just a human representation consisting of the two characters ^ and C.

In legacy character sets, the control characters often had a graphical representation, so on an old IBM PC (CP437) you would see a heart glyph ♥ if you looked at a file containing this character. In Unicode, it simply has no representation at all although some fonts contain a small box with the characters "ETX" in it (the "end of text" semantics from ASCII are purely historical, however). In my browser, <<>> is simply the empty string, but yours might show something else between the angle brackets.

Putting a ctrl-C in a here document will nevertheless not generate a signal; the signal is generated by the interactive terminal driver when it receives this character (and the character can be reconfigured easily; man stty). When the shell parses a here document, the terminal driver is not involved at all.

To send a signal from a script, use the kill command.



回答2:

I guess you mean the ^C character sequence?



标签: linux shell