[CentOS] good shell script examples?

Wed Nov 17 07:47:17 UTC 2010
洪 川 <caoyuwei at vip.qq.com>

#!/bin/bash


H="
192.168.1.1
192.168.1.2
192.168.1.3
192.168.1.4
"


for i in $H ; do
    expect << -EOF-
set timeout 2
spawn scp ${rootidfile} root@${host}:/tmp/id_file
expect "d:"
send "${password}\n"
expect eof
spawn ssh ${host}
expect "d:"
send "${password}\n"
expect "#"
send "mkdir -p /root/.ssh; chmod 700 /root/.ssh\n"
expect "#"
send "cat /tmp/id_file >> /root/.ssh/authorized_keys\n"
expect "#"
send "rm -f /tmp/id_file; exit\n"
expect eof
-EOF-

done




http://www.bsdmap.com/2010/11/06/ssh-shell-script/
 
 
------------------ Original ------------------
From:  "Kill Script"<killscript at gmail.com>;
Date:  Tue, Nov 16, 2010 02:47 AM
To:  "centos"<centos at centos.org>; 

Subject:  [CentOS] good shell script examples?

 
I am looking for a beginner guide to shell scripting simple tasks on CentOS (e.g. ssh'ing into a server / router / switch, checking for certain things, then exiting and going to the next IP).

Does anyone have any suggestions on where to look? ?(I'm relatively new to bash)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos/attachments/20101117/dc49d92c/attachment-0004.html>