Question: This week's submission will be to write a complete bash script named cop4342-complete.sh that should, when executed, do the following: bash4-2$ ./cop4342-complete.sh www.duckduckgo.com www.eff.org www.google.com
This week's submission will be to write a complete bash script named "cop4342-complete.sh" that should, when executed, do the following:
bash4-2$ ./cop4342-complete.sh www.duckduckgo.com www.eff.org www.google.com www.msnbc.com en.wikipedia.org www.yahoo.com www.zillow.com www.nytimes.com wget -H -q -P /tmp/tmp.7urSpOZAyF -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.duckduckgo.com.cookies https://www.duckduckgo.com Removing /tmp/tmp.7urSpOZAyF removed /tmp/tmp.7urSpOZAyF wget -H -q -P /tmp/tmp.H6n9pDtDG0 -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.eff.org.cookies https://www.eff.org Removing /tmp/tmp.H6n9pDtDG0 removed /tmp/tmp.H6n9pDtDG0 wget -H -q -P /tmp/tmp.FuZL8332S5 -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.google.com.cookies https://www.google.com Removing /tmp/tmp.FuZL8332S5 removed /tmp/tmp.FuZL8332S5 wget -H -q -P /tmp/tmp.RzhhZXiQ5o -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.msnbc.com.cookies https://www.msnbc.com Removing /tmp/tmp.RzhhZXiQ5o removed /tmp/tmp.RzhhZXiQ5o wget -H -q -P /tmp/tmp.o5by8KsGP5 -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies en.wikipedia.org.cookies https://en.wikipedia.org Removing /tmp/tmp.o5by8KsGP5 removed /tmp/tmp.o5by8KsGP5 wget -H -q -P /tmp/tmp.dWlTykrRP8 -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.yahoo.com.cookies https://www.yahoo.com Removing /tmp/tmp.dWlTykrRP8 removed /tmp/tmp.dWlTykrRP8 wget -H -q -P /tmp/tmp.UnfUOj67sS -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.zillow.com.cookies https://www.zillow.com Removing /tmp/tmp.UnfUOj67sS removed /tmp/tmp.UnfUOj67sS wget -H -q -P /tmp/tmp.8nJuNS7k1S -e robots=off -p -r -l 1 --keep-session-cookies --save-cookies www.nytimes.com.cookies https://www.nytimes.com Removing /tmp/tmp.8nJuNS7k1S removed /tmp/tmp.8nJuNS7k1S ==> www.duckduckgo.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:29. # Edit at your own risk. ==> www.eff.org.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:29. # Edit at your own risk. ==> www.google.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:29. # Edit at your own risk. .google.com TRUE / FALSE 1693336469 NID 511=vVctbgxiBOcSF6CD2VaJ81dwz43EU5_54rYCx8cjUhq5qydW02PJZbABwC-pDWh2gMcsDIMRXGAfXaJ5FDeGSHxqqB6JKVO_kAHcJSvOJ3cGwS2T701xZY05zrUv7vH1qHb2-1WugiW0zmdJrrfycdWaMWpyIREPJiMkf8BYMGc .google.com TRUE / TRUE 1693077269 AEC ARSKqsJATFe4uytpiBpXtN8JHKK83USAjcFDY3yOHinrqW2QlZQOQyMOUQ .google.com TRUE / TRUE 1680117269 1P_JAR 2023-02-27-19 ==> www.msnbc.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:30. # Edit at your own risk. www.msnbc.com FALSE / TRUE 1678389270 akaas_MSNBC 1678389270~rv=78~id=4290e8b35a8121478599818f67d1fc93~rn= ==> en.wikipedia.org.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:30. # Edit at your own risk. en.wikipedia.org FALSE / TRUE 1677542400 WMF-DP f38 en.wikipedia.org FALSE / TRUE 1680264000 WMF-Last-Access 27-Feb-2023 .wikipedia.org TRUE / TRUE 0 GeoIP US:FL:Tallahassee:30.48:-84.22:v4 .wikipedia.org TRUE / TRUE 1680264000 WMF-Last-Access-Global 27-Feb-2023 ==> www.yahoo.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:30. # Edit at your own risk. ==> www.zillow.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:31. # Edit at your own risk. www.zillow.com FALSE /captchaPerimeterX/ FALSE 1677527070 x-amz-continuous-deployment-state AYABeHEIfTMQ3XnPjmwscWjg448APgACAAFEAB1kM2Jsa2Q0azB3azlvai5jbG91ZGZyb250Lm5ldAABRwAVRzAxMTE2MjczQzlQQzdZU1JDTVBHAAEAAkNEABpDb29raWUAAACAAAAADG1zSqU7bUGhTAcRLAAwZTev9qQ5O8btKyWkxOgqpmCtvu4zSro8fOBwsYi1Kyayr7GdkLI3jtMurJlB5J02AgAAAAAMAAQAAAAAAAAAAAAAAAAAALSj6Dr9WolCZ2yutBk5JZr%2F%2F%2F%2F%2FAAAAAQAAAAAAAAAAAAAAAQAAAAzQSWFqffLrKGWtksQ5MrEINN5GxsMIF5cX2bQjMIF5cX2bQg== www.zillow.com FALSE / FALSE 0 JSESSIONID 92D90BE04B4470231EB7BEA431237BFA www.zillow.com FALSE / TRUE 1678130071 AWSALBCORS W+Mmi4WC5ixx8LPfZPYJeZSuyNbyD2lsNF84KBr+FcSVf6qtmMjsceEom2HTe6vL86Xk2vPZURWHVZLpHOtkRJv4ZY25PURV56dOpbyfROnJTP81CAC15te+X1IU www.zillow.com FALSE / FALSE 1678130071 AWSALB W+Mmi4WC5ixx8LPfZPYJeZSuyNbyD2lsNF84KBr+FcSVf6qtmMjsceEom2HTe6vL86Xk2vPZURWHVZLpHOtkRJv4ZY25PURV56dOpbyfROnJTP81CAC15te+X1IU www.zillow.com FALSE / FALSE 1677527070 x-amz-continuous-deployment-state AYABeHEIfTMQ3XnPjmwscWjg448APgACAAFEAB1kM2Jsa2Q0azB3azlvai5jbG91ZGZyb250Lm5ldAABRwAVRzAxMTE2MjczQzlQQzdZU1JDTVBHAAEAAkNEABpDb29raWUAAACAAAAADG1zSqU7bUGhTAcRLAAwZTev9qQ5O8btKyWkxOgqpmCtvu4zSro8fOBwsYi1Kyayr7GdkLI3jtMurJlB5J02AgAAAAAMAAQAAAAAAAAAAAAAAAAAALSj6Dr9WolCZ2yutBk5JZr%2F%2F%2F%2F%2FAAAAAQAAAAAAAAAAAAAAAQAAAAzQSWFqffLrKGWtksQ5MrEINN5GxsMIF5cX2bQj .zillow.com TRUE / FALSE 0 zgsession 1|8a6fce22-34a6-45c5-af21-737d686cdc5c .zillow.com TRUE / FALSE 1993101271 zguid 24|%2444bdba3a-0427-4965-9124-6f2d0342c7f1 ==> www.nytimes.com.cookies <== # HTTP cookie file. # Generated by Wget on 2023-02-27 14:14:31. # Edit at your own risk. .nytimes.com TRUE / TRUE 0 nyt-b3-traceid 16d15c5208764f05b0355719e6cb129f .nytimes.com TRUE / FALSE 1677546871 nyt-geo US .nytimes.com TRUE / TRUE 1709061271 nyt-purr cfhhcfhhhckfhd .nytimes.com TRUE / FALSE 1677546871 nyt-gdpr 0 .nytimes.com TRUE / TRUE 1709061271 nyt-a LnnOU9-bDyhNzDk4Ss8yI5 removed www.duckduckgo.com.cookies removed www.eff.org.cookies removed www.google.com.cookies removed www.msnbc.com.cookies removed en.wikipedia.org.cookies removed www.yahoo.com.cookies removed www.zillow.com.cookies removed www.nytimes.com.cookies
Clearly, your "cop4342-assign6.sh" script should loop over the arguments provided to the script; each iteration of the loop will create a ".cookie" file for each of the websites using the "wget" that you can see above. Once the script has finished the collection loop (and you can see that a local file is being created for each, such as www.yahoo.com.cookies), your script then uses "head -1000 $cookie_files" (where $cookie_files contains your list of files that have cookies) to list of all of the cookies with the very useful "==> FILENAME <==" divider provided by "head" automatically.
Your script should have the same output structure also as the above script, but the actual cookie data found may, of course, vary. I suggest using "mktemp" on the linprog machines to create your temporary directories --- please make sure that you clean up any stray temporary files that you create with this program.
It's not likely (though certainly possible) that your "head" output will be identical; it is conceivable that your "head" output is quite different since most of these websites change on a regular basis.
This is an easy assignment, but it will require putting together many of the techniques that you have seen and used so far this semester. My reference version only has 11 lines of active code, four blank lines, and the initial comment containing #!/bin/bash.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
