On Thu, Jul 06, 2006 at 10:41:55AM +0100, Jenny Hopkins wrote:
Hullo there,
I'm trying to echo a command to a serial port that happens to require a "!". In order to send the command I need to escape the ! with a backslash. However, I'm finding that at the other end, the backslash stays there rather than being stripped off, so the received command is also escaped and therefore doesn't work.
Emulated on a terminal: I send jenny@phaedrus:~$ echo "!tts MALE" > /dev/ttyp2 and receive !tts MALE
But I need to receive !tts MALE
That is because you quote the entire string. Quoting removes the special meaning of all characters (with the exception of $ in the case of double quoting), so the backslash in quotes represents a backslash character and is not interpreted as part of an escape sequence.
So, either
!tts MALE
or
"!tts MALE"
will work as expected, but not both.
Best regards, Jan