Reputation:
I need to write a script in bash using wget
which download a web page which has been passed to an argument and then the script should put the extracted page in a new file.html and then also extract all the tags of the web page in a second file and keep only the content of the web page.
This is the beginning of my script :
#!/bin/bash
$page = "https://fr.wikipedia.org/wiki/Page_web"
wget -r -np '$page' file.html
From the second part, I am blocked.
Upvotes: 1
Views: 106
Reputation: 22438
This will work:
page="https://fr.wikipedia.org/wiki/Page_web"
wget -O file.html -r -np "$page"
var_name=value
(no space allowed around =
)$var=val
is not correct, var=val
is."$page"
)From wget
manual:
-O file --output-document=file The documents will not be written to the appropriate files, but all will be concatenated together and written to file.
Upvotes: 1