Last active
August 29, 2015 14:24
-
-
Save tjbenator/145cfee185d3ca8eeb06 to your computer and use it in GitHub Desktop.
Generates a scp command for the given file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ ! -f "$@" ]; then | |
echo 'No valid file path given.' | |
echo | |
echo 'Usage: ' | |
echo "./$(basename $0) pathtofile" | |
exit 0 | |
fi | |
path_to_file=$(realpath "$@") | |
#Check for dependency | |
dpkg -s realpath 2>/dev/null >/dev/null || ( echo "Please install 'realpath'"; exit 1) | |
domain=$(hostname -f) | |
echo scp "$domain:$path_to_file" . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment