Menu

[r1]: / bin / pscp  Maximize  Restore  History

Download this file

48 lines (41 with data), 999 Bytes

#!/bin/bash

PROXY_PORT=${SSHPROXY_PORT:-2242}
PROXY_HOST=${SSHPROXY_HOST:-localhost}
PROXY_USER=${SSHPROXY_USER}
if [[ -z "${PROXY_USER}" ]]; then
   if [[ -n "${USER}" ]]; then
      PROXY_USER=${USER}
   else
      PROXY_USER=admin
   fi
fi

REMOTE=$PROXY_USER@$PROXY_HOST

OPTS=( )
remote_set=
args=( )
while [ $# -gt 0 ]; do
    case "$1" in
        -*)
            if [ "$1" = "-d" ]; then
                verbose=true
            else
                OPTS=( "${OPTS[@]}" "$1" )
            fi
            ;;
        *:*)
            if [ -z "$remote_set" ]; then
                args=( "${args[@]}" "$REMOTE:$1" )
                remote_set=yes
            else
                echo "Cannot have two remote locations"
                exit 1
            fi
            ;;
        *)
            args=( "${args[@]}" "$1" )

            ;;
    esac
    shift
done


[ -n "$verbose" ] && echo scp -oPort=$PROXY_PORT "${OPTS[@]}" "${args[@]}"
exec scp -oPort=$PROXY_PORT "${OPTS[@]}" "${args[@]}"
MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.
Try Free →