Guest User

Untitled

a guest
Nov 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. NUM_OF_SERVERS=(server1 server2)
  4. SSH_USERNAME=root
  5. SSH_PASSWORD=password
  6. version=$(cat /etc/redhat-release)
  7.  
  8.  
  9. for HOST in ${NUM_OF_SERVERS[@]};
  10. do /usr/bin/sshpass -p $SSH_PASSWORD ssh $SSH_USERNAME@$HOST echo "$version"
  11.  
  12. echo "The software version for ${NUM_OF_SERVERS[0]} is $version"
  13. echo "The software version for ${NUM_OF_SERVERS[1]} is $version"
  14.  
  15. done
  16.  
  17. bash: -c: line 0: syntax error near unexpected token `('
  18. bash: -c: line 0: `echo CentOS Linux release 7.4.1708 (Core) '
  19. The software version for server1 is CentOS Linux release 7.4.1708 (Core)
  20. The software version for server2 is CentOS Linux release 7.4.1708 (Core)
  21. The software version for server1 is CentOS Linux release 7.4.1708 (Core)
  22. The software version for server2 is CentOS Linux release 7.4.1708 (Core)
Add Comment
Please, Sign In to add comment