Thursday, January 3, 2008

WWWsh

  • meandering back from the County library, thinking about all the Google Search commands, I realized these were just a subset of the http://Yubnub.org commands.
  • This revived the idea of the World Wide Web shell, that Yubnub doesn't quit nail.
  • I'd given thought to making that shell with something like Kermit or CURL.
  • Some experiments with the information from the Yubnub html form indicated that the site makes extensive use of http redirection.
  • Using these tools would also require using some tool to render the html when that is appropriate (most of the time), yet leave it open to output raw html when appropriate (some times)
  • This points back to a web browser, with some kind of plug in, like some of the Yubnub tools listed on their web site.
  • One of the main charateristics of a shell interface is that it normally returns back to the prompt, or the command entry field, when it completes running a command.
  • To make sure that the you always get back to the Yubnub/WWW command prompt would require either something done at the client program or that Yubnub proxy all the final "command" output.
  • One way of implimenting this idea would be to edit some chunk of html form code into all web pages, and this could be done with Privoxy.
  • And so the following Privoxy filter, in /etc/privoxy/user.filter:

    
    ###################################################################### 14:24:24##
    #
    # yubnub: Try at a yubnub 'command prompt' on each web page
    #               30/12/2007 d.e.l.
    #
    #################################################################################
    FILTER: yubnub Try at a yubnub 'command prompt' on each web page
    
    
    s|(</body[^>]*>)|\
      <form action="http://www.yubnub.org/parser/parse" \n\
             + method="get" name="input_box"> \n\
        <input type="text" name="command" size="55" value=""/> \n\
      </form>  \n\
      $1|ig
    
    #  For a single text input field, Lynx  will submit on entering return,
    #    so no submit needed
    #  W3M and possibly members of the Links family browsers have
    #    function to force submission of forms
    #  To use with other browsers, you may need to include a line like
    #    this before the closing of the form with '</form>':
    #
    #   <input type="submit" value="Enter">
    #
                      
    
  • then this in user.action:

     
     { +filter{yubnub} }
     .
      
    
  • And after restarting Privoxy you get a screen shot like this:

    --
    ,,,                                            Los Angeles Free-Net's Home Page+
       The Los Angeles Free-Net
    
       A volunteer non-profit organization dedicated to bringing people
       together, providing community information, and offering Internet
       access at the lowest possible cost.
    
       [1]____________________________________________________
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    (Form field) Inactive. Use  to edit ('x' to submit with no cache).
    --
    

    Where the entry field is the command prompt/entry field.

  • In lynx, ^E will always put at the bottom of the current web page, which from now on will be the prompt location.
  • This has the obvious weakness that there must be a '</BODY..' tag for it to work, but then some apps run inside bash fail to complete properly and hang also.
  • It also turned out that default settings for Privoxy skip edits on sites with 'wiki' in the address (as one example), but it is normal for a shell to not present a prompt while an application is running also, so this makes some logic.
  • Time to start learning more Yubnub commands - the ones I think of off the top of my head are 'g ', 'w ' (for a weather report), 'wp ' 'ls' (for a list of commands).

Addenda 15 Jan. 2008

I should point out this idea could be used for simplified services, like Google search, standard and www.google.com/ie, google proxies like www.scroogle.com/scraper.html, etc. It's just that Yubnub includes these as commands, but if there were no Yubnub, these would certainly be fine enough to justify the idea. Also, I may need to rename this - I noticed that WWWsh is already used for some software of some kind!

4 comments:

Charles Wyble said...

One thing I might suggest is a gateway web service of sorts.

That could handle the various corner cases you mention and present valid HTML to the consuming application.

Such that people writing "shell scripts" wouldn't have to do a lot of heavy lifting.

The UNIX philosophy of simple tools in a pipeline.

Something to think about. Let me know. :)

dallas said...
This comment has been removed by the author.
dallas said...

1. Anyone may customize the trick to suit their own needs.
2. Although I don't currently understand it, Yubnub already provides something equivalent to a pipe, so I don't have to worry about that.
3. There are plenty of properly formed web pages on the Internet that I think it should be possible to always get to one as long as your browser hasn't crashed. If nothing else you can escape to your start page, 'aborting' a 'corrupt app'.
4. You don't normally expect to see the command prompt in the middle of a running application such as a pine, or in this case Wikipedia for example. I don't think this needs to be any different.
5. But, if you do you can always change/override your default Privoxy behaviour.
6. In short your point may be worth pursuing, I'm not going to worry about it right now!. :-)

dorla said...

Thanks for the sharing this website. it is very useful professional knowledge. Great idea you know about company background.
web application development