Skip to content

Instantly share code, notes, and snippets.

@tjbenator
Last active August 29, 2015 14:24
Show Gist options
  • Save tjbenator/145cfee185d3ca8eeb06 to your computer and use it in GitHub Desktop.
Save tjbenator/145cfee185d3ca8eeb06 to your computer and use it in GitHub Desktop.
Generates a scp command for the given file.
#!/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