In Linux how can I fetch an URL and get its contents in a variable in shell script?
If you have LWP installed, it provides a binary simply named "GET".
$ GET http://example.comExample Web Page You have reached this web page by typing "example.com", "example.net","example.org" or "example.edu" into your web browser.
These domain names are reserved for use in documentation and are not available for registration. See RFC 2606, Section 3.
wget -O-, curl, and lynx -source behave similarly.