Hi, im trying to write an BASH / Expect script to do some config checks. But im having an issu whit the split function in one of my functions.
All that i think is need is posted under, everything seems to work perfekt untill the script gets to "THIS LINE". Where i get the following error:
--------------------
wrong # args: should be "read channelId ?numChars?" or "read ?-nonewline? channelId"
while executing
"read "
invoked from within
"split [read ] '\n'"
invoked from within
"set acc_list [split [read ] '\n']
"
--------
Code:
function telnet_set_acl130 (){
expect << EOF
set timeout 20
set promt "% "
#Kobler til telnet til addr
spawn telnet $HOST
expect "Username:"
send "$USER\r"
expect "Password:"
send "$PASS\r"
expect ">"
send "en\r"
expect "Password:"
send "$en\r"
#Fjerner acl130 fra vlan 90
expect "#"
send "conf t\r"
expect "#"
send "interface vlan $vlan\r"
expect "#"
send "no ip access-group 130 out\r"
expect "#"
send "end\r"
#Fjerner acl130 fra noden
expect "#"
send "conf t\r"
expect "#"
send "no access-list 130\r"
#Oppretter nye acl130 paa noden
#Leser data fra "ok_acl/$rtacl"
set load_fh [open ok_acl/$rtacl r]
set acc_list [split [read $load_fh] '\n'] <<<--- THIS LINE
close $load_fh
foreach ip $acc_list {
if {$ip != ""} {
send "$ip\r"
}
expect "(config)#"
}
send "interface vlan $vlan\r"
expect "#"
send "ip access-group 130 out\r"
expect "#"
send "end\r"
#Lagrer endringer
expect "#"
send "wr\r"
expect "#"
send "exit\r"
EOF
}