Do you mean doing everything using only basic shell tools? I imagine it would be quite tricky to do in such a case. You'd have to write functions to manually analyze the html for conversion to the desired format. And html is not a format that can be reliably processed with the line-and-regex based tools available in a basic shell.
It should be quite possible however to write a script that would download the html and then run it through a dedicated converter, such as
pandoc.
Finally,
calibre apparently has the ability to download and convert web pages into ebook formats. But unless its one of the preinstalled ones you'd probably have to write your own filter plugin for it.