!!!Under Construction!!!

Be Brash!

These pages describe how to use brash -- which is a true Windows clone of the bourne shell with a few features from GNU bash thrown in. It also integrates several unix command line tools into itself to eliminate the need to download a whole planet's worth of s/w just to get normal command line functionality working.

By saying "a true Windows clone", it is meant that the program is written as a normal windows multi-threading executable without the need for GNU the simulation of the unix fork/exec behavior. It also means that windows file names are expected, not a simulation of the unix directory structure. Note that brash is a recoding of the bourne shell from scratch -- it is not a modification of the original bourne or brash shell code.

These pages do not include a complete programming guide to the bourne shell -- there are plenty of pages on the internet that do that. GNU Bash web pages will likely describe how to solve most programming problems in a manner that is consistent with how brash does it as well.

There are of course differences between the built-in commands in "brash", "bash" and the "bourne" shell. Click Here for details.

What's it for?

Brash exists to serve both as a convenient way to execute commands in a console window and to provide "bourne" style script language execution -- including< the definition of script language functions at the console and executing them.

It is distributed in source code form so that it can also serve as platform for creating "application specific" command libraries that operate at c++ program speeds rather invoking separate executables that invoke one another. Basically, you can string commands together using the built-in piping feature of the language and these commands can be written in C++.

Like cmd.exe, brash has the ability to page backwards through commands that you have previously executed using the up and down arrow keys -- so that you can easily re-execute any one of them. But, like the bourne shell and GNU bash, it has the ability to convert this command history into a file and let you edit your history for seamless re-execution as if the modified lines were stored in a script file. See the "fc" command.

Brash provides a true script language, unlike cmd.exe. Click here for a short list of reasons why CMD.EXE is not a real script language

Because brash is a re-coding of the bourne shell, you will not see any of these irregularities and special cases in it. You also get a lot more string manipulation functionality and regular expression functionality built into the interpreter. See the section on scripting, below.

One annoyance with brash, as with the bourne shell when run on Windows, is that the backslash character, (\), is an escape character. This means that when specifying file names, you must use double-backslashes instead of single-backslashes most of the time. Luckily, the brash console input mechanism has a way of automatically converting forward slashes (/) into double-backslashes -- you type in the name of a file and then you press the tab key. The tab key is also used for file name completion -- so, in brash, it also converts the forward slash into double backslashes. Unless the cursor is inside an apostrophe quoted string -- see the section on the console for more details.

Brash also integrates a variety of unix-like tools built into a single executable:

ls diff grep sed set
env basename dirname wc
cut cat head stat
Since these commands are "built-in", they have no program launch time. Scripts written using brash's builtin versions of these commands can be dramatically faster than having to launch separate programs to do these things.

It should be noted that the builtin versions are only "like" the corresponding unix commands. They typically only implement the most commonly used feature of those normaly external commands.

To reduce confusion, the versions of the above commands which are built into brash may have different names -- or a leading dot (.) at the beginning of the name. This lets you mix and mingle real executables with the builtin versions as you find that you need more functionality. This lets you go to source-forge and pull down the WIN32 versions of grep, sed, or whatever, and use it seamlessly with the brash builtins.

As an example, the grep functionality is approximated by the command ".regex -fl -m pattern files ...". Use its -h option for more details. Some of the sed functionality is also implemented in the .regex command.

The above subset of unix command line tools were chosen for inclusion in the baseline code base because these tools are strongly correlated with writing scripts.

There are lots of other commands which are builtin to brash. Use the command, builtins, to get a list. Use the -h option to the commands for more details.

The source for brash is publicly available and it is fairly simple to add your own built-in commands by following source code examples -- such as for the code for .head, .regex, basename, .wc, or whatever. Of course, you must write thread safe code in doing so. Look in brashBuiltins.cxx for the classes BrashBuiltinSolveExecutor and BrashBuiltinLinRegExecutor. These functions are mostly simple I/O and math operations but they do show how to read and write files and produce error message, etc.

Brash Console Interaction

Click Here

Brash Script Language

Click Here