links for 2011-06-28

links for 2011-06-24

links for 2011-06-21

links for 2011-06-20

每週小技巧

Expect Script

Expect 有它自己的 script syntax,for 跟 while 設定就有明顯不同。
還有設定變數的方式也不一樣。

設定變數成特定值:
set var1 10
set name “john”

計算:
set sum “[expr 1 + 1]”
set mul “[expr $sum * $sum]” 

 

if { $count < 0} {
    puts "True : $count\n";
} else {
    puts "False : $count\n";
}

for {set i 1} {$i < $no} {incr i 1} {
 set $total [expr $total * $i ]
}
puts "$total";
set count 5;

while {$count > 0 } {
puts "count : $count\n";
set count [expr $count-1];
}

Reference:
http://www.thegeekstuff.com/2011/01/expect-expressions-loops-conditions/