2

When I go to visit this url

https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories

using this command for lynx:

lynx -accept_all_cookies https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories

First I get a code like this -> [1] 4324 then another line which says -> bash: 10: No such file or directory

So, question is how can I browse this url url lynx? Also I can not curl this url , curl also showing nearly like same.

I am using ubuntu 12.04 LTS

2 Answers 2

3

Bash is interpreting the URL. The < and & mean things to it so they're being ripped around and aren't being passed to lynx.

The simple answer is to quote the url:

lynx -accept_all_cookies 'https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories'

I'm using single quotes here so that even $ isn't interpreted.

1
  • Thank you, now it's working! I am new in ubuntu, just learned a new things very useful from you. Apr 14, 2014 at 16:55
1

The problem is that your URL contains special characters that are being interpreted by the shell because you are not quoting it. So, short answer, use quotes:

lynx -accept_all_cookies 'https://github.com/search?q=jquery+stars%3A>10+forks%3A<10&type=Repositories'

Long answer: The specific issues here are >10 and &. The & sends a job to the background:

$ sleep 5 &
[1] 2015

Note that the above causes a similar message to appear, the number in brackets is the job ID, in this case 1 since it is the only job running in the background and the other number is the process ID (PID) of the backgrounded process.

The next issue is the <10 which means "read input from the file called '10' and >10 which the shell interprets as "redirect output to a file called '10'`. For example:

$ echo "Hello" > 10
$ cat 10
Hello

All of these issues can be avoided if you simply quote such things, quoting will protect special characters from being interpreted by the shell.

1
  • It works! Thanks for your excellent explanation! Apr 14, 2014 at 16:56

You must log in to answer this question.

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