Tuesday, April 30, 2024
4
rated 0 times [  4] [ 0]  / answers: 1 / hits: 1277  / 2 Years ago, tue, april 12, 2022, 1:32:55

I have a bash script called test.sh and it current is:



url=
lynx -dump $url > story.txt
echo "step one completed"


Except when I run ./test.sh http://www.fox.com or any website, story.txt says:



                            Forbidden
You don't have permission to access / on this server.


How do I fix it so that when I open story.txt, it displays the actual dump of the url?


More From » command-line

 Answers
1

Your script does not work for me, but I guess it does for you so we might have a different setup. I changed the script to



lynx -dump $1 > story.txt
echo "step one completed"


I run it with



 ./test.sh http://www.techland.ro


and I get the same result.



Instead of running the script with fox.com try with techland.ro and you will see that the script actually works just fine. The problem is not with your script but with the website you are trying to access. I believe it blocks website crawlers, because lynx is a command line browser it actually acts exactly like a crawler, resulting in the message you get.



You can set different rules for websites, if a website blocks unknown crawlers then it will also probably block lynx (or any other command line browser). Your script is fine, the website is blocking you.


[#33826] Tuesday, April 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
asketbridiculou

Total Points: 168
Total Questions: 116
Total Answers: 115

Location: Antigua and Barbuda
Member since Sat, Jan 28, 2023
1 Year ago
asketbridiculou questions
Thu, Dec 22, 22, 08:36, 1 Year ago
Thu, Jan 27, 22, 14:28, 2 Years ago
Tue, Nov 29, 22, 21:50, 1 Year ago
Sun, Jun 20, 21, 04:42, 3 Years ago
Sun, Aug 15, 21, 08:42, 3 Years ago
;