我有一个问题如下:
我有一个脚本,它从远程机器复制一个日志文件,对其进行一些修改,然后在 vim 中打开它,问题是 vim 不能自动识别文件类型(在脚本 ID 之外)——我需要这个着色日志。
脚本如下:
/usr/bin/rcp 14.1.61.10$node:/output/LocalLog_IPNode$node.log /export/home/fpd/tmp/tmp_local_log
chmod 777 /export/home/fpd/tmp/tmp_local_log/*
sed -i 's/[A-Z]\{4,8\}.*[oigus][kbdct][sel]\//---/g' /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log
vi /export/home/fpd/tmp/tmp_local_log/LocalLog_IPNode$node.log
我的.vimrc:
au BufNewFile,BufReadPost LocalLog* set filetype=local_log
请注意,文件在 vim 中打开(如果它有助于手动命令":set syntax=local_log"
也不起作用)。
退出脚本并手动打开日志后一切正常=(