使用tcl/expect实现字符串反转

来源:互联网 发布:北京时空软件 编辑:程序博客网 时间:2024/05/16 14:21
#!/usr/bin/env expect


# Reverse the string
set a "1234567"
set aLen [string length $a]
set iLen [expr $aLen - 1]


for {set i $iLen} {$i >= 0} {incr i -1} {
    append b [string index $a $i]
}


puts "b is <$b>"

原创粉丝点击