Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to download file using curl, but I get the following error message.

-o: command not found

My command was

curl http://lab.test.com/test/test/down.php?c=redsoul&bbs_no=236513&file_num=7061013&filename=%EC%95%84%EC%9D%B4%EC%96%B8%EB%A7%A8%2003%ED%99%94%20%28ANIMAX%201280x720%20x264%20AAC%29.SMI&size=25485 -o 'saveas.smi'

Do I have error with my command?

share|improve this question

migrated from stackoverflow.com Oct 20 '10 at 10:17

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

1  
question does not belong here – N 1.1 Oct 20 '10 at 7:08
    
Retagged your question since your issue is with how bash escapes special characters, not with curl. – Prof. Falken Oct 20 '10 at 7:09
    
@N, no, but kind of a little. Bash is after all a programming language, too. – Prof. Falken Oct 20 '10 at 7:10
1  
@N 1.1 // Sorry. I think it belongs to superuser.com. – user45326 Oct 20 '10 at 7:21
    
Or maybe serverfault.com? It is more of a server admin thing to muck around with scripts, right? – Prof. Falken Oct 20 '10 at 7:27

Your command looks OK, but you also need to quote the URL, like so:

curl 'http://lab.test.com/test/test/down.php?c=redsoul&bbs_no=236513&file_num=7061013&filename=%EC%95%84%EC%9D%B4%EC%96%B8%EB%A7%A8%2003%ED%99%94%20%28ANIMAX%201280x720%20x264%20AAC%29.SMI&size=25485' -o 'saveas.smi'
share|improve this answer
2  
Oh yes, with all those & characters it is wise to quote the URL. – eumiro Oct 20 '10 at 7:14
3  
What it did here was separating several commands: curl http://lab.test.com/test/test/down.php?c=redsoul, bbs_no=236513, etc. all of them are valid (variable assignments in bash)… except the last -o which follows a variable assignement and therefore is an other command – Benoit Oct 20 '10 at 7:46

You must log in to answer this question.

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