# Wait for "+QIND: PB DONE" response expect { "+QIND: PB DONE" { # Send AT command (automatically adds \r) send "AT" } timeout { print "Error: Timed out waiting for PB DONE" exit 1 } } # Wait for OK response after sending AT expect { "OK" { print "COMMAND EXECUTED" } timeout { print "Error: Timed out waiting for OK" exit 1 } } # Exit successfully exit 0