diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2014-01-09 14:22:49 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2014-01-09 14:22:49 +1300 |
commit | f10efbe770e5303a50502de7afc2d147688e03ca (patch) | |
tree | 1b75da4f12e56026b452e47d90ff7db524b5b55a /bash | |
parent | Upgrade Vim plugins (diff) | |
download | dotfiles-f10efbe770e5303a50502de7afc2d147688e03ca.tar.gz dotfiles-f10efbe770e5303a50502de7afc2d147688e03ca.zip |
Wrap scp with function to check for colon
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bashrc.d/ssh.bash | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc.d/ssh.bash b/bash/bashrc.d/ssh.bash index da38abce..1520a849 100644 --- a/bash/bashrc.d/ssh.bash +++ b/bash/bashrc.d/ssh.bash @@ -3,6 +3,15 @@ if ! hash ssh 2>/dev/null; then return fi +# Wrap scp to check for missing colons +scp() { + if (($# >= 2)) && [[ $* != *:* ]] ; then + printf '%s\n' 'scp: Missing colon, probably an error' >&2 + return 1 + fi + command scp "$@" +} + # Completion for ssh/sftp/ssh-copy-id with config hostnames _ssh() { local word=${COMP_WORDS[COMP_CWORD]} |