TCL/Expect not working as expected

I am having an issue with TCL\Expect; I am passing arguments via the commandline that are read in via "lrange $argv". One of those var's is a password with characters that need to be escapaed, after escaping them an hitting enter expect is placing curly braces around my password... why?!

#!/usr/bin/expect

## Setting stdin arguments as vars

set user [lrange $argv 0 0]
set password [lrange $argv 1 1]
set bladen [lrange $argv 2 2]
set ilomuser [lrange $argv 3 3]
set ilompasswd [lrange $argv 4 4]
set frame [lrange $argv 5 5]

## Verify that all arguments have been fullfilled


puts "Am citit:\n";
puts "user: $ilomuser";
puts "password: $ilompasswd";

#check if all were provided

if { $user == "" || $password == "" || $bladen == "" || $ilomuser == "" || $ilompasswd == "" || $frame == "" }  {
   puts "Syntax error\r"
   puts "Usage: <Username> <Password> <Blade number in frame> <New ILOM User> <passwd for ILOM user> <Frame IP>\r"
      exit 1
 }


Example. I ctrl+c to kill.. but as you can see the password has been curly braced.


-(~/work/sun6kchassis/working)------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(14:40 Mon Jul 20)
risk@Heavyarms [161] --> ./setuprilo.exp root thisisapass 3 drrib \$bu\!d1t 1.4.132.123
Am citit:

user: drrib
password: {$bu!d1t}
^Czsh: exit 130   ./setuprilo.exp root thisisapass 3 drrib \$bu!d1t 1.4.132.123

---------- Post updated at 05:53 PM ---------- Previous update was at 02:58 PM ----------

tried it in bash, no avail, also tried quoting, nothing... running out of ideas.

The curly braces are special in TCL, the strings inside them are not interpolated. I suppose that's the correct behavior if you want the string to be passed as is.

Well, the problem is, when it updates the password with that the password truely IS {$bu!d1t} when I need it to be $bu!d1t, any ideas?

Why aren't you using lindex?

set ilompasswd [lindex $argv 4]

Because I know no better :stuck_out_tongue:

But that fixed it !