Issues using the tilde ~ in a simple function wrapper around scp

Viewed 533

I want place a simple bash function in my .bashrc that wraps around the scp command by accepting a 'source' argument and 'destination' argument, and so far have tried both

function send() {
eval "scp $1 user@annoyingly-long-server-name:$2"
}

and

function send() {
scp $1 user@annoyingly-long-server-name:$2
}

...but when I call either of the above a la

send file.txt ~/

I get the error scp: home-directory-on-remote-machine: Operation not supported. After echoing each argument, it seems that the tilde is expanded into the remote machine's home directory before evaluation. How can I prevent this?

2 Answers
Related