grep用于tcl

来源:互联网 发布:樱井知香番号迅雷链接 编辑:程序博客网 时间:2024/04/30 20:16

if { [string equal [exec grep -o {hello} /root/file] "hello"] } {
   puts "Yay, it worked!"
}

此例的grep用的option -o是只显示一行中匹配的部分,所以可以和string equal同用

原创粉丝点击