Updated 27-July-2016

Brash: Bourne Reborn Again SHell

Using Brash
Downloads
Contacts
Compiling
SourceForge

Brash.exe is a re-coding of the bourne shell -- from scratch -- for the windows environment using threads instead of child processes. It also has some features borrowed from GNU Bash and a few new features of its own -- such as numerous simple but robust implementations of the normal unix helper commands: ls, diff, grep, sed, cut, expand, stat, etc.

Brash is not, in any way dependent on GNU libraries, but it is dependent on GNU source code for regular expression processing, and file name pattern matching. Nor is Brash in any way dependent on the CYGWIN environment. A few source files created by other individuals are also included. Each file in the distribution should be reviewed for copyright details. The .ver command lists all the corresponding copyrights.

Brash runs in a normal Windows Console and it supports TAB-completion that understands the windows file system:

Brash lets you write unix style pathnames, but when you press the tab key, it converts them to windows style names. Note that most of the time, this means using two backslashes to represent the directory separator:

c:\\dir\\path\\file
But if you are using apostrophe quote strings, brash recognizes this fact -- as best it can -- and uses a single quote in that situation. For example, if you type
echo 'fred/
Brash will change the text to
echo 'fred\
The difference being the number of back-slashes. Within an aphostrophe quote string, you get a single backslash.

The source code is fully available and was created specifically with the goal of being made public and covered mainly by the author's personal copyright, see below. Though some parts of the source are covered by the GNU copyright and possibly one other copyrights. Note that the parts that are covered by GNU copyrights could be easily replaced. I can explain this via email to anyone who is interested.

Why Bother with Brash?

Brash is meant for people who love the bourne shell or GNU bash but who need to work in the Microsoft Windows environment. Also, if you need unix commands that are not properly duplicated in Windows (diff, grep, sed, cut, etc), Brash can provide reasonable implementations of these in its single executable installation.

Windows developers who are used to using the CMD.exe program should have a low learning curve as well. The startup resources file, .brashrc, by default provides aliases and shell functions that map to both the CMD.exe environment and the bourne shell. For example:

Basically, brash lets you think like a unix programmer but also use all the tools available to you on windows.

Part of the bourne-like environment is provided using new builtin shell commands that provide unix like functionality. These new extensions to the bourne builtin command begin with the dot character:

So why not just use CYGWIN bash?

If you already have bash installed, there's no reason to switch to Brash, but if you don't -- for example if you don't have any of the cygwin tools, installed, you can install brash by downloading a single executable. (Just one!) You don't have to install a bunch of DLL's and use installer programs that modify your registry.

You should also download a .brashrc file, which will set up some common default emulations of standard windows commands. Or you you can emulate standard linux commands if you prefer. as well -- so the minimal download is actually these 2 files:

  1. brash.exe -- put in your PATH somewhere
  2. .brashrc -- put in your %USERPROFILE%

Brash is a true hybrid between unix and windows. If you are a unix/linux programmer who is also familiar with windows cmd.exe scripting, you will find that the annoyances of cmd.exe are gone but windows file names and commands are respected: most cmd.exe commands are available, or are easily scripted. Though you may to do do some of this yourself. See .brashrc for examples.

Note that the tab key will auto-convert unix and partially correct windows file names into correctly formatted file names. Use it often!

Licensing

Brash was developed with the specific purpose of making it freely available -- though some parts of the s/w are coverted by the GNU library license, version 2. See the individual source code files for more details.

The bulk of the source code, however, is covered by my personal license:


Copyright 2002-2016, Lowell Boggs Jr.

This file or directory, containing source code for a computer program,
is Copyrighted by Lowell Boggs, Jr. 987 Regency Drive, Lewisville
TX (USA), 75067. You may use, copy, modify, and distribute this
source file without charge or obligation so long as you agree to
the following:

1. You must indemnify Lowell Boggs against any and all financial
obligations caused by its use, misuse, function, or malfunction.
Further, you acknowledge that there is no warranty of any kind,
whatsoever.

2. You agree not to attempt to patent any portion of this original
work -- though you may attempt to patent your own extensions to
it if you so choose.

3. You keep this copyright notice with the file and all copies
of the file and do not change it anyway except language translation.

You are responsible for enforcing your own compliance with these
conditions and may not use this source file if you cannot agree to the
above terms and conditions.

For the .diff command copyright see en.wikibooks.org Although, I have signicantly modified the C++ version found there.

Downloads

Right click on one of the following links and use the Save-Link-As feature of your browser:
Advisory Date 32 bit Windows 7, 8, 10 .brashrc example Source code Readme File Release Notes Dev. Status Other Stuff
Version 1.2.15 29-Sep-2016 brash.exe brashrc Version 1.2.15 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.14 08-Aug-2016 brash.exe brashrc Version 1.2.14 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.13 07-Aug-2016 brash.exe brashrc Version 1.2.13 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.12 03-Aug-2016 brash.exe brashrc Version 1.2.12 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.11 31-Jul-2016 brash.exe brashrc Version 1.2.11 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.10 28-Jul-2016 brash.exe brashrc Version 1.2.10 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.9 27-Jul-2016 brash.exe brashrc Version 1.2.9 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.7 22-Jun-2016 brash.exe brashrc Version 1.2.7 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.6 21-Jun-2016 brash.exe brashrc Version 1.2.6 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.5 29-Jun-2016 brash.exe brashrc Version 1.2.5 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.4 29-Jun-2016 brash.exe brashrc Version 1.2.4 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.3 23-Jun-2016 brash.exe brashrc Version 1.2.3 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.2a 9-Jun-2016 brash.exe brashrc Version 1.2.2a brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.2.1 20-May-2016 brash.exe brashrc Version 1.2.0 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.40 1-May-2016 brash.exe .brashrc Version 1.1.40 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.39 17-Apr-2016 brash.exe .brashrc Version 1.1.39 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.38 17-Apr-2016 brash.exe .brashrc Version 1.1.38 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.36 01-Apr-2016 brash.exe .brashrc Version 1.1.36 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.35 30-Mar-2016 brash.exe .brashrc Version 1.1.35 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.34 29-Mar-2016 brash.exe .brashrc Version 1.1.34 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.33 06-Mar-2016 brash.exe .brashrc Version 1.1.33 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.32 24-Feb-2016 brash.exe .brashrc Version 1.1.32 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.31 23-Feb-2016 brash.exe .brashrc Version 1.1.31 brash.doc.txt Bugs, etc Complete mus
utf8dec
Version 1.1.30 22-Feb-2016 brash.exe .brashrc Version 1.1.30 brash.doc.txt Bugs, etc Complete mus
utf8dec

Note Use the brash command, builtins, to get a list of the available commands. Use the -h option for each builtin command for more details

Release Numbering Convention

Release numbers consist of 3 parts:
  1. Major release number -- new operating system ports, etc.
  2. Minor release number -- new functionality
  3. Bug fixes.

Installation Instructions

To install brash, you will need to have a BIN directory, a place in your windows Path environment variable that can used to store user created .bat files, programs, and scripts. You can call it what you like, but you must put brash executables therein.

Here's how to install brash:

  1. First, determine the name of a directory from your Path variable where you which to put the executables. You may want to add a new directory to your path.

    Suggestion, create the following directory:

    %USERPROFILE%/BIN

    Then add this directory to your path variable. This variable can be modified using:

    • Control Panel
      • System
        • Advanced
          • Environment Variables
  2. If you modify your Path variable, remember to exit any console windows so as to refresh the Path they are using.
  3. Once you have determined the name of the directory to hold brash.exe, make sure that you can put .bat files in that directory, and that you can execute them from a console window without needing to specify the full pathname to run the .bat commands.
  4. Use a browser to store BRASH.EXE in your bin directory of choice.
  5. In your %USERPROFILE% directory, download the .brashrc file from the brash downloads page. You may add additional customizations to this file later.
  6. From a newly created Windows console command line prompt, you should be able to type brash and see the following:
    Welcome to brash 1.1.20 ...
    From this point, you should be barely functional.

    Note -- you may have to create a new command window to get this to work if you have modified your windows Path in any way.

  7. Now, if desired, use the brash downloads page to store the following in your bin directory:
    • mus.exe (can be used vaguely like SED on linux)
    • utf8dec.exe (needed to make the sort command work right in most cases)
After installing, read the brash.doc.txt file for more details.

Compilation Instructions

brash.exe is available in a compiled form on this website, see above. It is only available, at this time, for Microsoft Windows 7, 8, and 10.

The source code can be obtained from the links above, and can be compiled using the following approach:

Requirements:

Compilation Instructions:

  1. Use your browser to download brash.zip to working directory where you can perform the build.
  2. Use unzip or WinZip to extract the archve. The top level directory will be named "cxx"
  3. cd cxx
  4. build.bat
The build should take about 2 minutes, give or take. When it is finished, it prints the names of executables which it has constructed. You should see the following names included in the list: The brash.exe program is in cxx/brash.

The others are in cxx/bin.

Other Stuff

In addition to the brash executable, the following optional executables are available with the same license restrictions: Use the -h options for more information.

Compatibility

Brash is intentionally meant to be as compatible with GNU BASH as possible, but that is very tall order. Here are the know limitations with respect to bash:

Limitations in version 1.1.33

  1. no support for GNU bash array variables (bourne doesn't have them either)
  2. "if", "while", and "untile" statements can only accept 1 command in the "condition" part of the statement. The body, of course can handle an unlimited number. Note: you can use a { ... } statement as the condition -- and it can have an unlimited number of members.
  3. missing or limited builtin commands:
    1. the keyboard handling lacks the depth of bash's configurability, but is fairly full featured. See "Console Window Edit Keys", below.
    2. the set command is very limited. Use the command "builtins" to get a list of what is supported.
    3. The following commands are not supported at all:
      caller enable exec help local printf readarray readonly suspend times trap typeset umask ulimit wait bg fg
    4. the & operator works to execute commands in the background
    5. history (instead use fc -l range...)
    6. the jobs command is very limited
    7. mapfile ( but read -f can simulate )
    8. test ( though [ expression ] does work )
    Brash understands the Windows file naming convention and lets you use it they it was meant to be used -- in a case insensitive manner. It also interprets forward slash in file names as if they were two backlashes -- especially when you use the Tab-completion feature of the console.

Contacts

Please contact the author at brash@mail.bordoon.com.