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中来自Lindex3的new_mac_list列表的mac_address
当我在new_mac_list中有4个mac地址时,它工作得很好,但当new_mac_list有少于4个mac地址时,我会将{}值传递给我的mac_list,而当new_mac_list有4个以上的mac地址时,我会将整个剩余列表元素作为mac_list中的一个元素。
发布于 2013-01-08 01:51:35
这就是如何附加多个元素(tcl8.5+):
lappend mac_list {*}[lrange $new_mac_list $i end]较旧的TCL将需要
set mac_list [concat $mac_list [lrange $new_mac_list $i end]]https://stackoverflow.com/questions/14201241
复制相似问题