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.