shell命令 grep不以某字符开头、ssh远程执行命令返回结果、ssh远程执行多个命令输入文件



shell命令  grep不以某字符开头,例如不以d开头


ls /data/|grep '^[^d]'

不能写成  ls /data/|grep '^[^d]*'


ssh远程执行命令返回结果、ssh远程执行多个命令

k=`ssh [email protected]  ls  -lh /home/unicomlabs/cq_bak5/done/tmp*|wc -l`

ssh [email protected]  'ls -lh /home/unicomlabs/cq_bak5/done/; ifconfig'

ssh [email protected]  'ls -lh /home/unicomlabs/cq_bak5/done; ifconfig' >> /home/unicomlabs/yangyu/jjj.txt;


ssh [email protected]  'ls -lh /home/unicomlabs/cq_bak5/done>/dev/null; ifconfig' >> /home/unicomlabs/yangyu/jjj.txt;


 for i in {2..25}
 do
        ip=10.161.21.$i
        echo $ip
        ssh unicomlabs@$ip       "/home/unicomlabs/wojianshescan_output_logs_orgin_eachdayfileprocess.sh>/dev/null;sleep 10;cat /home/unicomlabs/ip1.txt;cat /home/unicomlabs/ip2.txt;cat /home/unicomlabs/ip3.txt;cat /home/unicomlabs/ip4.txt;cat /home/unicomlabs/ip5.txt; df -h /home/unicomlabs/*_ast/config/config.ini|grep /|awk -F ' ' '{print \$5}';">> /home/unicomlabs/ip0.txt;
      tt=`cat /home/unicomlabs/ip0.txt|wc -l`;

你可能感兴趣的:(linux,shell)