I want to set in TCL the below error message as a variable and compare with the error message from a network switch, by-passing the special characters
Use [slot/port] or ["portname"] or [slot/*] or [*].
I tried in this way
set x "Use \[slot/port] or \["portname"] or \[slot/\*] or \[\*]."
but I am getting the following message while running my script:
extra characters after close-quote while executing
Please help. Thank you!
If you use double quotes, you also have to escape "inner" quotes:
set x "Use \[slot/port] or \[\"portname\"] or \[slot/*] or \[*]."
Or use braces and avoid escaping altogether
set x {Use [slot/port] or ["portname"] or [slot/*] or [*].}
See Tcl's 12 syntax rules, numbers 4 and 6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With