I am using scp to copy a file from a server to my computer. The command works fine when I type it from the command line, but when I try to make a script to do it, it fails with a "cp: cannot stat" error. It seems like the script is trying to check for the existence of a directory on my computer, when I do not intend it to do so.
I have a variable $LOGIN which equals user@server
Here is the command that works on the command line:
scp $LOGIN:dir/dir/file.txt .
Here is what I have in the bash script:
scp "$LOGIN:$1 $2"
Here is how I call the script:
./scriptname dir/dir/file.txt .
And the error:
cp: cannot stat ':dir/dir/file.txt': No such file or directory
Any ideas on how to get this script to work?