Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
share|improve this question
add comment

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

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

1 Answer

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?

share|improve this answer
    
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 '[email protected]:/{/root/install.log}' /. –  Keith Thompson Nov 2 '11 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 '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 [email protected]:{this_file,that_file}' / –  Keith Thompson Nov 2 '11 at 9:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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