November 6, 2020

For the last few days I’ve been playing with surfraw, a command-line program that allows easy access to a variety of search engines. About a hundred elvi (search agents) are provided, and it is easy to add your own. You can get surfraw from your favorite code repository (for me, it was sudo apt install surfraw). I use lynx for the browser, so everything works on the command line.

Your task is to install surfraw on your machine, write a custom elvi, and share it with the rest of us. When you are finished, you are welcome to read a suggested solution, or to post your own solution or discuss the exercise in the comments below.


Pages: 1 2

2 Responses to “Surfraw”

  1. Zack said

    Interesting. For the record, there is an online tool that does the same, with a large variety of options and customizations. It’s called Searx. Have a nice weekend!

  2. chaw said

    Here is a very simple elvi for a simple search of the Bangor Daily News site.

    # $Id: msg.txt,v 1.1 2020/11/06 14:58:45 chaw Exp $
    # elvis: bangordailynews        -- Search Bangor Daily News (
    . surfraw || exit 1
    w3_config_hook () {
        # Nothing yet.
    w3_usage_hook () {
        cat <<EOF
    Usage: $w3_argv0 [options] [search words]...
      Surfraw search Bangor Daily News (
    (There are no local options.)
    # no options currently
    w3_parse_option_hook () {
        case "$opt" in
        # -r*=*)      setopt   SURFRAW_google_results "$optarg" ;;
        *) return 1 ;;
        return 0
    w3_parse_args "$@"
    # w3_args now contains a list of arguments
    escaped_args=`w3_url_of_arg $w3_args`
    w3_browse_url "$url"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: