亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 3979 | 回復: 0
打印 上一主題 下一主題

expect交流,string match中規(guī)則表達式的規(guī)則 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2010-05-06 13:18 |只看該作者 |倒序瀏覽
本帖最后由 zhangshebao 于 2010-05-06 13:20 編輯

最近在寫expect腳本,用來管理網絡設備。
網上索了一下,有一些腳本。系統(tǒng)介絡expect的很少,也很淺。
expect1.3> string match
wrong # args: should be "string match ?-nocase? pattern string"
    while executing
"string match "
expect1.4> string match "*abc" "jkjkjabc"
1
expect1.5> string match "jkjkj{cba}" jkjkjabc
0
expect1.6> string match "jkjkj{abc}" jkjkjabc
0
expect1.7>  string match "{a-z}" "b"
0
expect1.8> string match "[a-z]" "b"
invalid command name "a-z"
    while executing
"a-z"
expect1.9> string match "{abc}" "b"
0
expect1.10> string match "\[a-z\]" "b"
1
expect1.11> string match "\[a-z\]+" "b"
0
expect1.12> string match "\[a-z\]\+" "b"
0
expect1.13> string match "\[a-z\]" "bcd"
0
expect1.14> string match "\[a-z\]{3}" "bcd"
0
expect1.15> string match "\[a-z\]\{3\}" "bcd"
0
現在確定string match "規(guī)則表達式" "串"
規(guī)則表達式中*表示任意字符串,\[a-z\]匹配1個字母。
誰知道expect中的expect及string match使用的規(guī)則表達式更詳細的用法?

expect1.16> set a "abc 123"
abc 123
expect1.17> if [ string match "*3" $a ] { puts "OK" }
OK
expect1.18> if [ string match "\[a-z0-9\]\[a-z0-9\]\[a-z0-9\] \[a-z0-9\]\[a-z0-9\]\[a-z0-9\]" $a ] {puts "ok" }
ok
expect1.19>

bash-3.2$ expect
expect1.1> ?
ambiguous command name "?": after append array auto_execok auto_import auto_load auto_load_index auto_qualify binary break case catch cd clock close concat
continue debug disconnect encoding eof error eval exec exit exp_close exp_continue exp_debug exp_disconnect exp_exit exp_fork exp_getpid exp_inter_return ex
p_interact exp_internal exp_interpreter exp_log_file exp_log_user exp_match_max exp_open exp_overlay exp_parity exp_pid exp_remove_nulls exp_send exp_send_e
rror exp_send_log exp_send_tty exp_send_user exp_sleep exp_spawn exp_strace exp_stty exp_system exp_timestamp exp_trap exp_version exp_wait expect expect_af
ter expect_background expect_before expect_tty expect_user expect_version expr fblocked fconfigure fcopy file fileevent flush for foreach fork format getpid
gets glob global history if incr info inter_return interact interp interpreter join lappend lindex linsert list llength load log_file log_user lrange lrepl
ace lsearch lset lsort match_max namespace open overlay package parity pid proc prompt1 prompt2 puts pwd read regexp regsub remove_nulls rename return scan
seek send send_error send_log send_tty send_user set sleep socket source spawn split strace string stty subst switch system tclLog tell time timestamp trace
trap unknown unset update uplevel upvar variable vwait wait while
    while executing
"?"
expect1.2> string ?
bad option "?": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, tri
mleft, trimright, wordend, or wordstart
    while executing
"string ?"
expect1.3> string match
wrong # args: should be "string match ?-nocase? pattern string"
    while executing
"string match "
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP