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 [email protected]:/{/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 [email protected]:/{/root/install.log} /
scp: /{/root/install.log}: No such file or directory
bash-3.2$ which scp
/usr/bin/scp

1 Answer 1

2

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

csh% echo [email protected]:/{/root/install.log}
[email protected]://root/install.log

bash$ echo [email protected]:/{/root/install.log}
[email protected]:/{/root/install.log}

Why do you want the curly braces anyway?

4
  • yes, I want to copy multiple file.
    – user87005
    Nov 2, 2011 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 '[email protected]:/{/root/install.log}' /. Nov 2, 2011 at 7:38
  • same problem bash-3.2$ scp [email protected]:/'{/root/install.log}' / [email protected]'s password: scp: /{/root/install.log}: No such file or directory
    – user87005
    Nov 2, 2011 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 [email protected]:{this_file,that_file}' / Nov 2, 2011 at 9:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .