#!/bin/bash if [ ! -f "hosts" ]; then echo "No hosts file found." exit 1 fi while read line; do echo $line scp -r "$line/*" results/ done <hosts