0

Why do I get a different behavior of the scp command in csh and bash?

Same command is working in csh shell, but it not working in bash shell.

Please can anybody help?


bash-3.2$  csh
Linux-007% scp root@1.2.3.4:/{/root/install.log} /
install.log 100% 98KB 97.6KB/s 00:00
Linux-007%  which scp
/usr/bin/scp

Linux-007% bash
bash-3.2$  scp root@1.2.3.4:/{/root/install.log} /
scp: /{/root/install.log}: No such file or directory
bash-3.2$ which scp
/usr/bin/scp

migrated from stackoverflow.com Nov 2 '11 at 7:47

This question came from our site for professional and enthusiast programmers.

2

scp isn't the issue. The problem is in the way the two shells handle curly braces.

csh% echo root@1.2.3.4:/{/root/install.log}
root@1.2.3.4://root/install.log

bash$ echo root@1.2.3.4:/{/root/install.log}
root@1.2.3.4:/{/root/install.log}

Why do you want the curly braces anyway?

  • yes, I want to copy multiple file. – user87005 Nov 2 '11 at 7:35
  • 1
    The command you showed us only copies one file. But if you want the braces to be interpreted on the remote system, put single quotes around the argument: scp 'root@1.2.3.4:/{/root/install.log}' /. – Keith Thompson Nov 2 '11 at 7:38
  • same problem bash-3.2$ scp root@1.2.3.4:/'{/root/install.log}' / root@12.3.4's password: scp: /{/root/install.log}: No such file or directory – user87005 Nov 2 '11 at 7:42
  • Then drop the braces. If you're copying a single file, as you seem to be trying to do in your example, don't use braces. If you really need to copy multiple files, use braces and commas, and quote them: scp root@1.2.3.4:{this_file,that_file}' / – Keith Thompson Nov 2 '11 at 9:14

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.