Skip to content

Instantly share code, notes, and snippets.

@grantm
Last active December 10, 2015 02:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save grantm/4367372 to your computer and use it in GitHub Desktop.
Save grantm/4367372 to your computer and use it in GitHub Desktop.
Ever forgotten the ':' after the hostname of an scp command?
# a useful addition to anyone's .bashrc
#
# Note, you don't want this function in effect on the remote host side of the scp transfer,
# so make sure to only define it for interactive shells, e.g.: wrap with: if [ ! -z "$PS1" ]
function scp() {
if echo "$@" | grep -q ':'
then
/usr/bin/scp "$@"
else
echo -e "\e[31;1mYou want to put your what in my where!?!?\e[0m"
fi
}
@kramse
Copy link

kramse commented Mar 6, 2014

mine from KSH .profile:
wscp()
{
if [[ "$@" = +(:) ]];then
/usr/bin/scp "$@"
else
echo 'You forgot the colon dumbass!'
fi
}
alias scp=wscp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment