Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to be able to generate HTML then pipe it to a program which will render it, something like this:

for i in 1 2 3
do
    for j in a b c
    do
        echo "<table border="1"><tr><td>$i</td><td>$j</td></tr></table>"
    done
done | /usr/bin/firefox

Unfortunately, firefox can't render data piped in from stdin. Neither can google-chrome. lynx can, but who wants to use that?

I tried creating a named pipe, opening that in chrome and/or firefox and then piping data to that -- but the browser didn't update when I sent data through the named pipe.

Are there any non text-based browsers which will render html from stdin? The output doesn't need to be glitzy, I'm mostly interested in making delimited data a little more readable, on the fly.

Edit:

I tried using bash's process substitution, e.g. firefox <(sh /tmp/tablegen.sh), that didn't work either. Worst case scenario, I could output to a temp file, render, then delete, but I would prefer a slightly more elegant solution.

share|improve this question
1  
Similar question here: unix.stackexchange.com/questions/24931/… –  wmz Dec 31 '12 at 14:34
    
Good link; pretty well confirmed my suspicion that using a temp file is the only way to go. –  Barton Chittenden Jan 1 '13 at 17:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.