I can configure my Accesspoint via console and now I want to do this bulk via expect command. It does not work and i suspcect that the problem is that expect does not like : in variables.
This is my script. I expect expect to send $macadress to the console of my accesspoint. But it stays empty. While debugging sometimes I saw the first two chars of my macadress being shown. Does expect not work with variables containing colons? However, i tried escaping colones which also did not work.
A possible usage might be
expect block-mac.expect aa:bb:cc:dd:ee:ff accpoint-01
#!/usr/bin/expect
# Usage block-mac.expect <mac-adress> <hostname-accesspoint>
set macadress [lindex $argv 0];
set accesspoint [lindex $argv 1];
puts $accesspoint
puts $macadress
spawn ssh admin@$accesspoint.mydomain.com
expect "*assword:" { send „super_securer“}
expect "Router" { send "enabler"}
expect "Router#" { send "configure terminalr"}
expect "Router(config)" { send "wlan-macfilter-profile mac-filterr"}
expect "Router(config-wlan-macfilter mac-filter)#" { send "filter-action denyr"}
expect "Router(config-wlan-macfilter mac-filter)#" { send "$macadressr" }