The first WordBash site

header image


Hey. Welcome to the WordBash Website.

WordBash is a WordPress Clone written in BASH, the GNU Bourne Again SHell.

You read that correctly. And the cool part is that basic WordPress operation has been achieved at only 2,500 lines. Yes, you read that correctly. You can download a demo version and see for yourself:

WordBash WordPress Clone written in GNU Bash.

UPDATE December, 2014: WordBash has been updated (much improved) and is now Free Software. See the above page to download.

Development Delay

Posted on March 14, 2015

As can be seen I have not been updating this site. It is not due to lack of interest—this was a really fun project. Finally becoming fluent in Bash was satisfying.

And I have proven my point: Blog Code written entirely in Bash really is viable.

Ever search for a phrase similar to "how to do X in bash"? only to find the "solution" to be actually SED or AWK or some coreutils program? Happens 98% of the time.

The goal of WordBash was to code something indistinguishable from WordPress but 100% Bash only CGI. And early on I decided to do it from scratch, creating all my own code. (This is why my coding style is unique.) Because when first I did look at some existing Bash CGI code, like bashlib-0.4, they all used not Bash itself but programs like GREP, SED, TR and PRINTF for basic processing of data such as QUERY_STRING. Which I did not want to do.

"Could a solution be found with just Bash?" I asked myself. The answer is, "Yes." And that is what I have done.

I have suspended development—for now. I have some new ideas churning in my head that I want to try; there are improvements I want to implement; and I need to release the Admin code. I will do these things. Just not too soon.

Category: default | comments closed

Timing in Bash

Posted on May 23, 2014 04:13AM

Bash does not seem to have a builtin timing funtion beyond times, but one cannot store it's output in a variable to time a routine. (Would be cool if Bash had a TIMES variable.)

But I'm stubborn so I tried something odd and came up with a basic timing mechanism. This times how long is takes to create a small file nine times:

bash code

# timing


times >t.$$

t=($(< t.$$))






while [ $i -gt 0 ]; do

    times >t.$$

    t=($(< t.$$))




    echo "$m, $n"

(( i–- ))


rm t.$$


Of course the two time variables need to be converted to integers or something.

Would be nice if there was some sort of memory cache for the temp file. (But Bash should just create that TIMES variable.)

Function: striptags

Posted on Feb 6, 2014 19:05PM

Stripping HTML tags in Bash is straight forward and uses a single state flag (the examples use a global named data):

bash code

# strip tags


st() {




    for (( i=0; i<$n; i++ )); do

        if [[ ${data:$i:1} == ">" ]]; then t=0; continue; fi

        if [[ $t == 1 ]]; then continue; fi

        if [[ ${data:$i:1} == "<" ]]; then t=1; continue; fi





That, though, only demonstrates that expanding a string one character at a time is slow. Sometimes case is used for parsing data, so let's give it a try:

Continue reading →

Bubble Sort

Posted on Feb 3, 2014 20:02PM

WordBash needed a sort function, and I did not want to use an external program, so I start one and I'm like... "Ah, my brain hurts... Wait just a minute! Who has done this already!

bash code

# Algorithm B (Bubble sort), Knuth Vol. 3, page 107

bs() {

local a j n r t


    n=${#a[@]}; (( —n ))

    while [ $n -gt 0 ]; do


        for (( j=0; j<$n; j++ )); do

            if [[ ${a[j]} -gt ${a[j+1]} ]]; then









    echo "${a[@]}"


Returning Arrays

Posted on Nov 28, 2013 4:33AM

You may have come across an example or two showing how to "return an array" in Bash. Yet simply returning a space delimited string of words which to "convert" to an array doesn't actually work right.

Here's what I mean:

bash code

ret_array() {

a=("foo bar" "jar")

echo "${a[@]}"



# a=([0]="foo" [1]="bar" [2]="jar")

As you can see, that's wrong.

But we can do something weird to fix it—use a newline as a delimiter:

bash code

ret_array() {

a=("foo bar" "jar")

for (( i=0; i<${#a[@]}-1; i++ )); do



echo "${a[*]}"




# a=([0]="foo bar" [1]="jar")

So arrays can kind of sort of be "returned" from a function.

Note: "${a[*]}" has to be used for the "return" rather than "${a[@]}" else a subtle error occurs. See Shell Parameters for a bit more information.

Function: strtoupper

Posted on Nov 28, 2013 3:51AM

The previous post, Sequence Expression, was a lead in to this function to convert a string to uppercase (for Bash pre-4.0).

bash code

strtoupper() {

local i j n s a b c





    for (( i=0; i<$n; i++ )); do


        for (( j=0; j<26; j++ )); do

            if [[ $c == ${a[j]} ]]; then







    echo "$s"


Yuck, all those locals... but, what else can you do? Really, post a comment if there's a more efficient way. Can't get around comparing each character with each letter of the alphabet though; at least the break helps a bit (or, a byte, ahem...).

Bash: Sequence Expression

Posted on Nov 28, 2013 5:35AM

In Brace Expansion, the manual states:

A sequence expression takes the form {x..y[..incr]}, where x and y are either integers or single characters, and incr, an optional increment, is an integer.

Well the manual ain't famous for providing lots of examples and there's none for assigning a sequence expression. It's not obvious as this shell example shows:

Continue reading →


Posted on Nov 28, 2013 4:33AM

Recent breakthoughs in multi-processing computer technology and software design methodologies have enabled todays Web Apps to do more than ever before.

Utilising the most advanced in cutting edge technologies, this is an introduction to a new Advanced and Powerful Web Blogging Application!

With over three years experience in the software industry behind me, I introduce a new software implementation backbone framework utilizing Design Patterns with Continual Integration through Design Modeling and have produced a new Syntagmatic Personal Publishing Platform:

WordBash is written in Bash, the GNU Bourne-Again SHell. All content of this website is generated by a shell script. All comments submitted are parsed, stored and displayed by Bash.

First Post in a new era!

Posted on Nov 28, 2013 2:47AM

Welcome to the future! Shall it be yours? All you have to do is... reach out and grasp it!

Because here it is! This is the fork in the history of Personal Publishing Platforms. The software running this site is revolutionary in scope and scale.