SCP taming: stop local silliness

Every day now and then, I get an scp command wrong. Scp is designed after commands like rcp and works totally fine for local-to-local file copy.

While this can (or could) be useful in some contexts, It's not what I like to do these days; very often, if either hosts is not remote, it's a typo on my part, and results in spurious "" files somewhere in various directories on my disk.

So, what I like to do? I put a small script like this in my path before the actual scp executable in order to pre-check arguments, and prevent accidental local-only copies.


for var in "$@"
    if [[ $var = *":"* ]]; then
        $ORIG "$@"
        exit $?

echo "ERROR: Missing colon. You need to pass at least one remote host specifier in source or dest"
exit 1