When a file name contains spaces ,the file name need escape two times in scp command.
I can get file "somesoft someversion.apk" from remote ip address into my local "tmp" directory:
scp user@ip_address:/share/"somesoft\\ someversion.apk" /tmp
It works fine.Now i want to use a var name to refer to the file "somesoft someversion.apk".
fname="somesoft someversion.apk"
scp user@ip_address:/share/"$fname" /tmp
The var can't be parsed properly in scp command:
scp: /share/somesoft: No such file or directory
scp: someversion.apk: No such file or directory
How to expand variable whose value contains space properly in scp command?
Now here is the real case,scp works fine with two time escapes:
Now to set a var and assign value with it,then scp:
"'$fname'"
have no magic effect in this case.