Using SSH instead of SCP

Using the program SCP is not needed, use this scipt to use SSH for transferring files:

$ ssh [email protected] "cat /remote/file" > /local/file

To use this trick in a shell script-wrapper:

$ cat
#!/bin/sh -x

host=$(echo "$1" | cut [email protected] -f2 | cut -d: -f1)
user=$(echo "$1" | cut [email protected] -f1)
remotefile=$(echo "$1" | cut -d: -f2)

if [ ! "$host" -o ! "$user" -o ! "$remotefile" -o ! "$localfile ] ; then
echo "Please use all requires options, for example:"
echo "$0 [email protected]:./file ."
exit 1

ssh $host "cat $remotefile" > $localfile
$ chmod 755

Now "replace" the normal SCP by using an alias:

$ alias scp="~/"

One flaw of this script is that all options will have to be configured statically in .ssh/config.