[BUSH User Guide]

Home Page Introduction Tutorials Reference Packages Hacking


This section contains a high level overview of the BUSH shell. It includes a discussion of the design concepts and brief comparisons to similar tools.

1.1 Overview

Do you want to see a BUSH script? Here is a short one.

? "Hello World!";

There are many shells, interpreters and languages available.  Virtually without exception, they are incompatible with one another.    What's the point of learning a tool that, no matter how sophisticated it is, leaves your source code stuck with that particular tool.  You want to do scripting, so you use Python or Scheme.  You want to do reporting, so you use Perl.  You want to write a script, so you use Bash.  You want to write an applet, so you use Java.  To be a programmer these days, you need to be fluent in a dozen different languages.  You would be making more money if you got a job at the United Nations.

The Business Shell is different.  It is part of a language environment called ABEE, one of the most powerful and flexible environments available for Linux today. It's based on a language called AdaScript, a subset of GCC Ada, so that any project you write in Bush is immediately portable to any machine that GCC runs on.  In other words, virtually everything.  And it means that Bush scripts can be compiled using GCC and everyone knows that GCC is superior to most commercial compilers.

A Bush Script A GCC Program
procedure hello is
  pragma ada_95;
begin   put_line( "Hello World!" ); end hello;
with text_io;
use
text_io;
procedure
hello is   pragma ada_95;
begin   put_line( "Hello World!" ); end hello;

You don't have to rewrite your scripts to use them in applications. Use the same variable types, the same structures, the same built-in packages. Cut-and-paste your code.

If that's not enough, using the JGNAT open source compiler, you can even compile your Bush scripts into actual Java bytecode.  There is another tool, A#, that will compile scripts into .NET byte code  Things don't get much more platform-independent than that.

What about PHP? BUSH has a HTML template engine that runs embedded scripts in a secure environment. No need to worry about users messing with your code...unless you want them to.

<html>
<head>
<title>Bush script embedded in a web page</title>
</head>
<body>
  <?bush ? "Hello World!"; ?>
</body> </html>

It's the same BUSH source code that you use for your scripts. No need to learn a special template language with a new set of rules.

But Bush does more than just create scripts, executable programs and Java applets.  It's a powerful computer language on its own able to do complex math, manipulate files, generate reports and able to do network programming.  Bush will let strings grow as big as you need without worry of a running out of buffer space.  And a number of built-in packages will let you do everything from compute trig functions to connecting to a web server.

But best of all, Bush is easy.  Perl claims to be easy.  Easily like riding a bicycle backwards in the middle of a thunderstorm.  Bush is easy to read, easy to understand.  You know exactly what a script does without having to have a reference book beside you at all times

Bush doesn't run your programs outright.  First it examines them, compresses them, and converts them into intermediate code.  (That's "byte code", to you Java developers.) Bush optimizes the program for the best possible performance. It also takes the time to verify your program will run before attempting to execute the first line.

And if you make to typing mistake, Bush will let you know before running your program.  There's no need to worry that your typo will be a valid command like it would be in most other languages.  Bush works for you, not against you.

One tool for all solutions.

And, yes, Bush is also makes a pretty good shell.

So you basically have two choices. Keep working for the U.N., or give Bush a try and make your life a little easier.

 

1.2 Ada-BUSH Enterprise Endeavor (ABEE)

Besides working as a standalone solution, BUSH is designed to work with other tools to create complex web development environments.  This environment is called the Ada-BUSH Enterprise Endeavor (ABEE).  BUSH, together with other tools like GCC, creates a standardized framework for developing web templates, server applications, client side JVM and .Net applets and scripts.  ABEE is an open source alternative to proprietary offerings like ASP .Net and Sun's J2EE.

The following chart shows how BUSH fits in with to an ABEE web development environment:

 

[Ada-Bush Enterprise Model]

Figure: ABEE Multitier Enterprise Application Model

Client-Side Presentation

On a user's desktop can run native Ada 95 applications created with the Win32 version of Ada Core Techologies' GNAT (another name for GCC Ada) or one of the commercial desktop Ada compilers.  Alternatively JVM applications can be created with Ada Core Technologies' JGNAT Java byte code compiler.  Or create .Net applications using A#, the Ada .Net compiler.  You can also create JVM or .Net applets to run in a client's web browser.  In all these cases, using Ada means that developers need to know only one core language.

Server-Side Presentation

The web server can use BUSH web templates to create web pages with embedded AdaScript code.  Like JSP, ASP, PHP and similar products, BUSH can connect to databases and generate new web content dynamically.  BUSH templates can communicate to the other layers by opening TCP/IP sockets (for remote machines) or by files (on local machines).  Using AdaScript for your templates means that developments use the same core language as used in the other layers.

Server-Side Business Logic

To manage and cache information, compiled applications and server software can be built using GCC Ada.  The server software gain the speed advantage of binary code for the host machine while still being able to communicate with the other tiers through files, TCP/IP sockets.  Cluster computer can be done using GCC Ada's GLADE environment: GLADE partitions a single application over multiple computers without worrying about the underlying operating system.  You can also share objects using Ada's CORBA implementation.  Process control and information flow can be coordinated by BUSH scripts.

Enterprise Information Systems

BUSH has integrated support for SQL so there usually no reason to reply on a database client program. The stored procedure language for most databases is very similar to AdaScript and is intuitive to learn and use if developers are already familiar with ABEE. The database package with BUSH is also available with GCC Ada applications.

At each layer, developers will need to know only one core language, with the same basic constructions and types.  For example, a "for loop" is written the same way in any tier, whether for a .Net application or a BUSH web template.  This reduces training costs and makes source code portable between the tiers over solutions that require different languages at each tier.  In addition, the same core packages are available (string handling, math, lock file handling, I/O, and others).

In comparison, consider Sun's Java 2 Enterprise Edition (J2EE) environment.  Java "components" (small applications) can be distributed across an information system using secure connections to negotiate with one another. Ignoring Sun's marketing buzzwords, you can see that the open source ABEE approach is as good as or superior to J2EE:

J2EE is not your only solution for writing multitiered enterprise applications.  The ABEE strategy offers the same advantages as solutions offered by Sun. Reusable components, client interaction using HTML/XML/HTTP, scalability and high availability over a network are all possible with an ABEE strategy. Ada-Bush allows applications to be written once and run everywhere, supports CORBA technology to interface with existing enterprise resources, and creates a single standard that can be use effectively throughout an enterprise. Plus you get to use a truly scalable language system that cuts down training expenses and allows applications to be "scaled up" with minimum effort. And did we mention that it's free and open source?

The components ABEE standard is the result of the work of the U.S. government, Ada professionals and open source volunteers.


1.3 Comparing BUSH

There are many open source scripting languages and shells available.  They are often created to solve particular kinds of problems.  The following sections summarize the major differences between BUSH and these other common tools.

 

BUSH vs. BASH

BASH (the "Bourne Again SHell") is an extended version of the traditional UNIX Bourne shell (sh).   BASH supports most of the Bourne shell's original syntax, but also has features of the C and Korn shells such as integer and array variables.  The Bourne shell syntax is hard to debug and is not compatible with other computer languages.  BASH can act as an interactive shell or can run scripts.

BUSH is a shell that  has the fundamental syntax of the Bourne shell.  However, BUSH uses a different language for advanced features making BUSH easier to read and debug.  BUSH scripts can be compiled into Java or .NET byte code or into an executable program.  BUSH's reliability, scalability and speed make it ideally suited for professional scripting projects.  BUSH can act as an interactive shell and can run scripts.

BUSH vs. Python

Python (named after "Monty Python") is an interpreted language designed for small projects needing rapid development. It is not a shell. Because of it's weak encapsulation features and lack of strong typing,Python scripts are limited in scalability and extensibility. The shortcuts provided by Python cause reliability problems in large, complex projects. Because of its proprietary design, projects developed in Python cannot easily be upgraded to a compiled language.

BUSH is a shell and language designed for high reliability business and scientific applications. BUSH scripts are slower to develop than Python programs but are easier to maintain over the lifetime of a project. The shortcuts BUSH provides are carefully chosen so as not to undercut reliability. BUSH scripts can be easily upgraded to a compiled language.

BUSH vs. Perl

Perl ("Practical Extraction and Report Language") is, as its name suggests, a scripting language for data analysis and designing reports. PERL is good for writing short scripts to process text information such as system logs.

Perl is well known for being hard to learn and read. It combines the features of completely unrelated tools (including shell scripts, the sed command, and the awk command). In fact, this was the reason Larry Wall developed Perl in the first place. Perl scripts must be extensively commented to be readable. BUSH, on the other hand, is based on an international standard and has features that are designed to fit together smoothly. BUSH scripts are very readable, even with limited comments.

Perl developers also endorse Perl's shortcuts as making scripts more reliable (by making them a smaller) and as aid for programmers. BUSH also contains shortcuts, but it makes no claim that smaller scripts are easier to maintain. While Perl shortcuts can actually hurt development, BUSH's shortcuts are carefully chosen so that a programmer can't "shoot himself in the foot". Some kinds of shortcuts are dangerous. Perl will convert a number to a string automatically, whether or not the programmer made a mistake. If BUSH sees a number where a string was expected, it reports it as a serious contradiction.

Perl is not a shell and is not designed to run programs or to handle process control. However, it contains many features beyond report generation, including interprocess communication and database access. Because of its pattern matching features, cryptic syntax and shell-like quoting rules, Perl makes large projects error-prone and difficult to maintain.

Perl is often described as portable. With GNU tools and the Linux operating system, portable languages like PERL are no longer necessary. Even when PERL is chosen for portability, it is not based on any standard: features can change and break between even minor releases of PERL making PERL scripts difficult to port and upgrade. BUSH is heavily tested and based on an international standard making it more portable than PERL.

BUSH is a Linux shell and shell language designed for high reliability business and scientific applications. Although it's not a report generation language, it can generate reports using formatted output and pattern matching like PERL does.

BUSH scripts are not as "quick-and-dirty" as PERL but but BUSH scripts are easier to maintain over the lifetime of a project. Because of its emphasis on a typo-resistant syntax, BUSH is easier to maintain, especially when used large projects. BUSH scripts can also be compiled into executable programs, Java applets or .Net programs.

BUSH vs. PL/SQL

PL/SQL is the Oracle stored procedure language.  Both BUSH and PL/SQL are based on Ada making BUSH very easy to learn for PL/SQL users.  Many PL/SQL commands and statements will work in BUSH.  BUSH supports the PostgreSQL database and you can execute queries and examine results.

BUSH vs. PostgreSQL psql

psql is the text-based database client for PostgreSQL. You can display information about databases, run queries and get formatted responses. It is not a shell and cannot run shell commands.

BUSH is a shell and scripting language. In addition, it can display information about PostgreSQL databases, run queries and display the results as psql-style responses all at the BUSH command prompt. The user doesn't have to switch between a shell and psql--BUSH handles most database needs by itself.

BUSH vs. Ada 95

Ada 95 (named after the world's first programmer) is a multithreaded, exception handling, object-oriented programming language used for large, high-integrity projects. It is known for abundant features, high performance, strong checking and readability.

The BUSH shell is not an Ada interpreter. BUSH uses AdaScript, a subset of the Ada 95 language with additional features specifically for interactive shell sessions. Because of its Ada 95 background, BUSH scripts are easy to create, maintain, debug and can be compiled into fast, executable programs using an Ada 95 compiler.

If you are looking for full Ada compilers or interpreters, they are available on the Internet.

BUSH vs. Java

Java is an interpreted programming language with threads, exception handling and object-oriented features. It can be compiled into "byte code" and applets can be created for web pages.  Java is known for it's awkward syntax, poor performance and debugging problems because of its C heritage.  Java is not a shell.

BUSH scripts can also be compiled into Java or .NET byte code (using the JGNAT compiler) and run the same way as Java applets/applications, including web page applets.  BUSH scripts are easy to create, maintain, debug and can be compiled into fast, executable programs using GCC.

BUSH vs. PHP

PHP is an HTML preprocessor and scripting language. In many ways, PHP resembles Perl but it is not Perl-compatible. PHP is often difficult to debug. It is not a shell and it does not have a native template engine.

BUSH is a shell and language designed for high reliability business and scientific applications. BUSH scripts are more secure and robust than PHP and they are easier to debug and maintain over the lifetime of a project. BUSH has a native template engine. BUSH scripts can be easily upgraded to fast, compiled applications (using GCC) or applets (with JGNAT).

BUSH vs. Ruby

Ruby is a scripting language with threads, exception handling and objects.  Ruby is completely object oriented.  Ruby has a very compressed syntax that uses the "Principle of Least Surprise"--that is, Ruby attempts to "second guess" the programmer.  In some cases, removing a single space, or capitalizing a single letter, can cause a Ruby script to radically change its behavior.  Ruby is not a shell.

BUSH is a shell and language designed for high reliability business and scientific applications. BUSH scripts are slower to develop than Ruby programs but are easier to maintain over the lifetime of a project. Changing capitalization and white space does not change the how a script is run. BUSH features do not fall victim to the "feature bloat" syndrome that weakens the reliability of a language. BUSH scripts can be easily upgraded to a compiled application or applet.

BUSH vs. QBASIC/QuickBASIC

QBASIC or QuickBASIC is a text-screen or console version of the BASIC language with a built-in IDE.  It features interactive debugging and drop-down menus.  BUSH, when combined with PegaSoft's TIA IDE, provides a text-screen language with drop-down menus and interactive debugging.
 

1.4 Installation

Complete installation details are in the README and INSTALL files included in the BUSH download file.

1.6 IDEs That Support BUSH

If you prefer to work with an integrated development environment, PegaSoft's Tiny IDE for Anything/Ada (TIA) supports BUSH.


Screenshot of the TIA IDE

The File/Check command will run BUSH with the --check (syntax check) option.

Tia is designed for building large projects. In the project parameters window, chose "Make" and create a Makefile so that TIA can build and execute your Bush projects.  As long as your scripts contain a "#!" line and have executable permissions, they should be runnable from TIA after a project is built.

Instructions for using TIA are contained in the Big Online Book of Linux Ada Programming.
 

1.7 The Value of a Common Language Model

BUSH offers advantages over a PHP/Apache/Perl/C solution.

 Feature   C   Perl   PHP   Shell   BUSH /
GCC Ada
 
 String Equality  strcmp/strncmp eq == = =
 Number Equality  == == == -eq =

Bush performs all equality operations with a single tool--the equals sign. When your choice of development environment involves 4 different possibilities for equality, is this really an advantage or are developers spending too much time in paradigm shifts and adapting their software from one tool to another?

 Feature   C   Perl   PHP   Shell   BUSH /
GCC Ada
 
 Undefined Variables  never var == undef empty() -z (null string) never
 String Concatenation  strcat/strncat . or word expansion . word expansion &
 Arrays  fixed size, 0-based index variable size, 0-based index variable size, 0-based index or strings variable size, 0-based index fixed size, integer or enumerated index

Which is easier to use? Which has a smaller risk of errors? Consider the fact that Java adds yet another non-standard level of incompatibility while ABEE (BUSH + GCC Ada) offers a consistent environment where you can be sure that fundamental features all behave the same.

1.8 Progressive Development Model

BUSH recognizes a fundamental problem in business programming. Programmers with limited time and resources are often required to write up quick scripts to solve pressing business problems. Once the script is written, they have no time to return to the script to write a "proper" solution. Scripts, designed for rapid and simple solutions, continue to grow and mutate, becoming rapidly unreadable and easily broken, leaving a complete rewrite in a different language as the only way to upgrade the software.

To combat this problem, BUSH scripts can be developed using a progressive development model.

In its native mode, BUSH provides a quick and easy environment to write short Linux programs. Like BASH, variables can be declared anywhere and can be typeless. Although its structure is relaxed compared to a compiled programming language, AdaScript's syntax is both easier to read than a BASH script and provides much more security against typing errors. Common errors in BASH such as missing a quotation or spelling mistakes on variable names are quickly caught.

As an BUSH script grows over time, becoming longer and carries more responsibility, the structure of the script can be improved by using "pragma ada_95". This BUSH directive disables many of the "lazy" AdaScript features such as typeless variables and requires closer conformation to the Ada language. A programmer can "tighten" his code as part of his regular duties, add type checking, and ensure that the script's structure is sound and the source is readable without resorting to a complete rewrite.

Some important scripting features, like running commands in the background with "&", are still allowed.

Finally, if the BUSH script continues to grow and is no longer suitable as a script, the script can be compiled with minimum changes as an Ada program. With other shells and scripting languages, a developer would have no choice but to rewrite the script "from scratch".

Results of an HP-UX benchmark with an early version of BUSH 0.8 shows that BUSH (when compiled) easily outperforms than the fastest shell tested. It ran about 16 times faster than BASH. Except for white space, the output was identical to the original shell script. It did not require a rewrite into another programming language.
 

End of Document