Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Escaping square brackets

Help
Paul Brown
2010-07-14
2013-05-02
  • Paul Brown
    Paul Brown
    2010-07-14

    Hi all,

    I am having trouble with some escape characters.  I have a script that expects:

    CONFIRM :

    on the command line.  But I can't seem to escape the square brackets.  My code was:

    expect "CONFIRM \[y\]: "
    send "y\r"
    

    I have tried a number of escape sequences for the square brackets such as:

    expect "CONFIRM \: "

    but have got nowhere.  I have got this working before but have lost the file.  It was something quite annoying with a lot of back/forward slashes.  Any help would be greatly appreciated, thanks for looking.