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.

One of my most common tasks is:

1) Open a bunch of tabs

2) Copy and paste the URL from the address bar, as well as the body text, of each open tab into a text editor

Is there a way to script this from the Linux shell, even though I'm browsing in the GUI?

I get tired of having to do it all the time.

share|improve this question
1  
Can you be more specific about what you're trying to do? Are the URLs in the address bar or in the body of the page? It might make a difference what browser you're using. The usual way to script retrieval and parsing of web pages is to start by retrieving the page using curl or wget. You don't say which operating system, but your use of the word "shell" seems to imply Linux/Unix. Please see How to Ask and How To Ask Questions The Smart Way. –  Dennis Williamson Jan 31 '11 at 15:29
    
@Dennis Williamson done –  ixtmixilix Jan 31 '11 at 23:09
add comment

1 Answer

up vote 0 down vote accepted

One possibility, if you don't mind downloading the same URLs twice, is to do something like this:

#!/bin/bash -e
for url in 'http://www.example.com/foo/bar.html' \
       'http://superuser.com/questions/239935/scriptable-web-browsing' 
       # and so on
do
    TMPFILENAME=$(mktemp)
    firefox "$url"   # or whatever browser you want that is set to open
                     # links in a new tab
    echo "$url" > $TMPFILENAME
    lynx -dump "$url" >> $TMPFILENAME
    kate $TMPFILENAME &  # or any other text editor that is set to open
                         # files in a new tab
done
share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.