比较多台机器配置文件是否相同 remote_diff.sh
2012-07-31 14:36
323 查看
#!/bin/sh if [ $# -ne 2 ] ; then echo 'error args'; exit ; fi file=$1; machine=$2; rm -rf ~/.tmp/*; yinst ssh -c "scp '$1' hostname:~/.tmp/\`hostname -s\` " -h $machine 2>/dev/null; first_file=""; for i in ~/.tmp/*; do if [ "$first_file" == "" ]; then first_file=$i; else echo "diff $i $first_file"; diff "$i" "$first_file"; fi done
2. 用法:
(1). remote_diff.sh /home/....../test.conf "abc[1-4].cm7 -h mach.cm7"
把远程所有机器的配置文件copy 到 本地 ~/.tmp目录中;然后所有的配置文件与第一个配置文件进行diff;打印出不同的信息
(2). 批量处理命令:yinst
相关文章推荐
- perl比较文件数据是否相同(Algorithm::Diff模块)
- 比较两个目录文件是否相同
- iOS 对比两个文件内容是否相同 MD5摘要 与 直接比较
- python中比较两个文件是否相同
- PHP比较两个文件是否相同
- Linux md5sum比较两个文件夹下面文件是否相同
- 【shell】比较两个文件是否相同
- 分享一个bat脚本,比较文件输出是否相同,并输出第一个不同的位置
- 比较两个文件是否相同
- 把大文件分成多个小文件(内含hash值比较文件是否相同方法)
- 使用MD5比较两个文件是否相同
- java快速比较两个文件是否相同
- 两台硬件和软件配置完全相同的机器A和B,现在要用系统自带的Copy功能把A上的一个文件,复制到B上。在哪台机器上执行程序,效率更高?
- shell脚本示例:批量比较多个文件的内容是否相同
- 获取文件的哈希值(用来比较两个文件是否相同)
- C++中的freopen()函数实现比较两个文件的内容是否相同
- 比较两个文件是否相同(比较两个流是否相等)
- asm--文件使用--比较两个文件是否内容相同
- linux 比较文件相同部分comm命令和不同部分diff命令
- 比较两个文件是否相同(C/C++语言)