#!/usr/bin/env bash print_help() { cat < '$to'" elif [[ $# -eq 3 ]]; then declare -r remote="$1" declare -r from="$2" declare -r to="$3" cat "$from" \ | pv -s $(stat -c %s "$from") \ | ssh -o ClearAllForwardings=yes "$remote" "cat > '$to'" else print_help exit 2 fi