BV1AL 之無所不記

2006-05-26

interactive的ap也可程式化

大多時候我們手操作的applications是可以程式化的, 其中以 vi(m)最方便.
試試看以下幾個動作
echo -e "iHello world\033ZZ"|vi test.txt
cat test.txt
echo -e "Y5p\033ZZ"|vi test.txt
cat test.txt
echo -e "2j5lD\033ZZ"|vi test.txt
cat test.txt
也就是可以將 vi 含在 shell script 裡來自動執行
其他像是 fdisk 也可以如法泡製

1 Comments:

張貼留言

<< Home