#!/usr/bin/perl -w @files=`git status -s` ; @sync_files = (); foreach (@files) { $file = substr($_,3); # 固定前2个字符为状态 + 1个空格 chomp($file); push(@sync_files, $file); } $cmd = "scp -r "; foreach $file (@sync_files) { $cmd = $cmd.$file." "; } $cmd = $cmd.' ops@192.168.1.1:/home/ops/'; print $cmd."\n"; system($cmd);