SCP bash script

SCP bash script

A SCP bash script I wrote for SCP transfer via SSH. Any explanations needed please post a comment.

Have been really busy lately so haven’t done many updates so am sharing a script I wrote, although the script can be useful for automating scp its aimed as howto use scp example as well as learning howto use a Linux (Bash) shell.

#!/bin/bash

echo “Enter Filename  if in the same directory (relative path) if not use the full path to the file (absolute path) i.e /bin/bash instead of bash”

read SOURCE

echo “Enter destination server”

read DESTINATION

echo “Enter destination directory, must include / i.e /root not root”

read DESTINATIONDIR

echo “SSH Port?”

read PORT

echo “Username?”

read USER

scp -P $PORT $SOURCE $USER@$DESTINATION:$DESTINATIONDIR
In English or direct syntax to enter would be.

scp -P 22 file root@someserver.com:/root

Bash Scripting, Linux , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

2 + twenty =