Monday, December 14, 2009

useful TCL command


a, wait [args]
delays until a spawned process (or the current process if none is named) terminates.

sample:
spawn telnet 172.18.9.38
expect "login"
send "admin\r"
expect "assword:"
send "1\r"
#expect "accept):"
#send "a"
expect "#"
close
wait
sleep 1

Saturday, December 12, 2009

Vi tutorial

a, how to show line number in vim?
:set number <==> :set nonumber

b, how to open 2 windows:
:split xxx.txt or :vsplit yyy.txt
u can control the size of the new window: :3 split xxx.txt
ctrl-w to switch the active window.

c, where am I?
ctrl-g

d, search the string three?
/three
how to highlight the result?
:set hlsearch
:nohlsearch