aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-01-09 14:22:49 +1300
committerTom Ryder <tom@sanctum.geek.nz>2014-01-09 14:22:49 +1300
commitf10efbe770e5303a50502de7afc2d147688e03ca (patch)
tree1b75da4f12e56026b452e47d90ff7db524b5b55a /bash/bashrc.d
parentUpgrade Vim plugins (diff)
downloaddotfiles-f10efbe770e5303a50502de7afc2d147688e03ca.tar.gz
dotfiles-f10efbe770e5303a50502de7afc2d147688e03ca.zip
Wrap scp with function to check for colon
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/ssh.bash9
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]}