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. As such there are some differences which are discussed below.
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.
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.
Unlike the windows command program, cmd.exe, you will not see any irregularities and special cases in the meaning of statement syntax. You also get a lot more string manipulation functionality and regular expression functionality built into the interpreter. See the section on scripting, below, for more details.
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 integrates the key features of a variety of unix-like tools built into a single executable:
ls diff grep sed setSince 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.
env basename dirname wc
cut cat head stat
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 GNU executables with the builtin versions when you find that you need more functionality than brash provides. 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 installation process only has 3 steps:
brash -hto get a list of command line options.
Once brash is up and running, use
builtinsto get a list of built-in commands.
For scripting examples, any web search for the bourne shell way of doing things should apply to brash. (With a small number of exceptions listed elsewhere in this website.)
Look in cxx/brash/brashBuiltins.cxx for the classes
To create a new command: