TCL set Special Characters in a string

前端 未结 3 1066
名媛妹妹
名媛妹妹 2020-12-20 05:24

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

<
3条回答
  •  感情败类
    2020-12-20 05:59

    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

提交回复
热议问题