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.


Escaping square brackets

Paul Brown
  • Paul Brown
    Paul Brown

    Hi all,

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


    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.