Help With Expect Script IF with Multiple Conditions

I am needing to include some if statements within an expect script. These will need to have two conditions under an AND join. Upon a successful IF condition I want to set multiple variables.

I have tried a lot of variations of the below statement with no success. I have also searched the WEB with every possible combination to attempt to find the answer.

Does anyone know of what I am missing to make this work?

Variant 1 -

if { $user = "USER1" -a $mode = "PROD" } {
     set port "224"; set remote "PROD"; set archive "local;}

Variant 2

if [ $user = "USER1" -a $mode = "PROD" ]; then
     set port "224"
     set remote "PROD"
     set archive "local
fi

Hi.

One could Google for tcl if statement syntax. Then something like this might show up:

#!/usr/bin/env tclsh

# @(#) tcl1     Demonstrate tclsh feature.

set version [ info tclversion ]
set message " Hello, world, tcl version ($version).\n"
puts stdout $message

puts "Hey dude, how old might you be?"
gets stdin Age
if {$Age >= 0 && $Age <= 12} {
  puts "You are a child."
} elseif {$Age >= 13 && $Age <= 19} {
  puts "You are a teen."
} elseif {$Age > 19}  {
  puts "You are an adult now."
}

producing:

% ./tcl1 
 Hello, world, tcl version (8.4).

Hey dude, how old might you be?
15
You are a teen.

Best wishes ... cheers, drl

drl,

Thanks for the additional information.

I began my quest creating the statement just as you have it. I am using a unix file format (LF) and my if statement was setup just like yours.

With this being the case I decided to just do the single condition if statement.

I am getting extra tokens at end of expression while executing.

My error statement is as follows

if {$user="USER1"} {
set acmode "I am USER1"
} elseif {$user="USER2"} {
set acmode "I am USER2"
}

All lines immediately end in a line feed.

I also have started looking at the search variation you listed. The search continues for what I am doing wrong.

Regards,
Slagathor