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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.