You are not logged in.

#1 2015-09-26 11:26:59

damo
....moderator....
Registered: 2015-08-20
Posts: 6,108

HowTo: Searching the Crunchbang forums

There is a vast repository of information on the  Crunchbang site, which you can search using your browser: in the search box use

site:crunchbang.org/forums/  <searchterm>

For a quick method, use this script, which can be run from the Run box (gmrun, Alt-F2) to produce search engine results in the browser.

Copy and Paste the code, save as "cbs" in ~/bin, and make it executable. Choose which search method you want by (un)commenting the appropriate lines. Choices are:

  • Google

  • DuckDuckGo

  • Startpage

(See the "Usage" for other options)

In the terminal or Run box you can now do

cbs your search terms

The script:

#!/bin/bash
# Search the Crunchbang forums
# by johnraff
# add DuckDuckGo & Startpage options by damo <damo@bunsenlabs.org> October 2015
# Name the script "~/bin/cbs"

USAGE='USAGE:
search words  - search the forum with several words, other google stuff like OR also OK.
"search phrase" - search for fixed phrase
-t topic word - search for topic in title, word anywhere
-t "topic phrase" word - search for "topic phrase" in title, word anywhere
-t topic -t subject - search for topic AND subject in title
-h or --help - this message
etc...'

unset q
while [[ $1 ]]
do
    case $1 in
        -t)
        shift
        if [[ $(echo $1 | wc -w) -eq 1 ]]
        then
            q="$q intitle:$1"
        else
            q="$q intitle:\"$1\""
        fi
        ;;

        -h|--help)
        echo "$USAGE"
        exit 0
        ;;

        *)
        if [[ $(echo $1 | wc -w) -eq 1 ]]
        then
            q="$q $1"
        else
            q="$q \"$1\""
        fi
        ;;
    esac
    shift
done

x-www-browser "http://www.google.com/search?q=site:crunchbang.org/forums/ $q" &
##x-www-browser "https://duckduckgo.com/?q=site:crunchbang.org/forums/ $q" &
##x-www-browser "https://startpage.com/do/search?q=site:crunchbang.org/forums/ $q" &

exit 0

Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#2 2015-09-29 15:14:02

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: HowTo: Searching the Crunchbang forums

Tried your script, but it only opens a Google search page, not the Crunchbang forums page. Is that what it is supposed to do?
It doesn't run in gmrun.

Offline

#3 2015-09-29 15:19:45

schwim
Member
From: Western NC, US
Registered: 2015-09-29
Posts: 257
Website

Re: HowTo: Searching the Crunchbang forums

It's supposed to open a Google(or other, if you've uncommented) search result page as it's querying the search engine for your search term.


Schw.im! A social site with an identity crisis.

Offline

#4 2015-09-29 15:23:03

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,891

Re: HowTo: Searching the Crunchbang forums

The Google page is supposed to open.

gmrun: Make sure that the file is executable and in $PATH.

--

Another nice method is using surfraw which essentially obsoletes the OP's script:

apt-get install surfraw
alias cbs="surfraw -g google site:crunchbang.org/forums"
cbs YOUR SEARCH TERM

Per aspera ad astra.

Offline

#5 2015-09-29 15:25:28

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: HowTo: Searching the Crunchbang forums

schwim wrote:

It's supposed to open a Google(or other, if you've uncommented) search result page as it's querying the search engine for your search term.

Okay, thanks.
To this to work, the #! community website has to be alive, right? Will it also work, if that website archived?

Offline

#6 2015-09-29 15:26:55

hhh
Meep!
Registered: 2015-09-17
Posts: 10,138
Website

Re: HowTo: Searching the Crunchbang forums

twoion wrote:
alias cbs="surfraw -g google site:crunchbang.org/forums"
cbs YOUR SEARCH TERM

Elegant!

Offline

#7 2015-09-29 15:38:45

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,891

Re: HowTo: Searching the Crunchbang forums

The good thing about surfraw is that it contains "elvis" for many more search engines: DuckDuckGo, Ixquick, …

surfraw -elvi

Per aspera ad astra.

Offline

#8 2015-10-01 02:01:01

vasa1
Member
Registered: 2015-09-29
Posts: 185

Re: HowTo: Searching the Crunchbang forums

twoion wrote:

...

apt-get install surfraw

...

Or maybe first apt-get install -s surfraw and then your choice of apt-get install surfraw or apt-get install --no-install-recommends surfraw.


Using the Openbox (3.5.2) session of Lubuntu 14.04 LTS but very interested in BL :)

Offline

#9 2016-02-14 12:19:32

shot-in-the-head
Member
Registered: 2015-10-28
Posts: 61

Re: HowTo: Searching the Crunchbang forums

twoion wrote:

The Google page is supposed to open.

gmrun: Make sure that the file is executable and in $PATH.

--

Another nice method is using surfraw which essentially obsoletes the OP's script:

apt-get install surfraw
alias cbs="surfraw -g google site:crunchbang.org/forums"
cbs YOUR SEARCH TERM

The surfraw alias doesn't work for me, maybe it's because I use zsh not bash

Offline

#10 2016-02-14 12:48:12

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,891

Re: HowTo: Searching the Crunchbang forums

shot-in-the-head wrote:
twoion wrote:

The Google page is supposed to open.

gmrun: Make sure that the file is executable and in $PATH.

--

Another nice method is using surfraw which essentially obsoletes the OP's script:

apt-get install surfraw
alias cbs="surfraw -g google site:crunchbang.org/forums"
cbs YOUR SEARCH TERM

The surfraw alias doesn't work for me, maybe it's because I use zsh not bash

Strange, while not being a zsh user myself, according to this, the alias syntax should be (almost?) equivalent. What kind of error do you get? Perhaps it's related to surfraw and possibly missing elvis, or a different surfraw version.


Per aspera ad astra.

Offline

#11 2016-02-14 12:56:19

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: HowTo: Searching the Crunchbang forums

The alias syntax is identical in zsh wink

@shot-in-the-head: have you added the alias to ~/.zshrc?

"Doesn't work" isn't very informative -- verbatim error messages are always better.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

Board footer

Powered by FluxBB