1
set mac_list ""
set new_mac_list "1111.1111.1111 2222.2222.2222 3333.3333.3333 4444.4444.4444"
lappend mac_list [lrange new_mac_list $i end]

在我的脚本中,我的值始终为 3 这个概念是我总是想要我的 mac_list 中 lindex 3 的 new_mac_list 列表的 mac_address

当我在 new_mac_list 中有 4 个 MAC 地址时它工作正常,但是当 new_mac_list 的 MAC 地址小于 4 mac_list..

4

1 回答 1

4

这就是附加多个元素的方式(tcl8.5+):

lappend mac_list {*}[lrange $new_mac_list $i end]

较旧的 TCL 需要

set mac_list [concat $mac_list [lrange $new_mac_list $i end]]
于 2013-01-07T17:51:35.393 回答