Un article de Le wiki de 2 noisettes - noisette.ch.
#Usage: put_key servername
function put_key(){
if [ ! -s ~/.ssh/id_dsa.pub ]
then
ssh-keygen -t dsa
fi
cat ~/.ssh/id_dsa.pub | ssh $1 'sh -c "cat - >> ~/.ssh/authorized_keys2"'
}
#Usage: servers /path/to/local/file /path/to/remote/location/file
work_server[0]="server1"
work_server[1]="server2"
work_server[2]="server3"
function servers(){
for host in "${work_server[@]}"
do
scp $1 root@$host:$2
done
}
Bash/for-vs-while
Articles dans la catégorie « Bash ».
Il y a 9 articles dans cette catégorie.