Compare and Contrast Between the Bash Shell Scripting Language and the Ruby Programming LanguageAt first glance these two languages appear to be poles apart. Bash shell script with its roots in Unix terminal scripting versus a modern object-oriented scripting language. So, are these two languages really that different and what might they have in common? This paper aims to answer these questions. Bash Shell was implemented in 1989 by Brian Fox. Its purpose was to act as a "command processor". In other words, this language would act as an interface between the user and the GNU operating system (mostly installed on Linux-based systems). Bash scripts are created with an editor and run with the Unix sh command. The Bash language itself is highly procedural, supporting shell variables and procedural constructs such as if and loop. Bash provides an excellent means of combining Unix commands and their results in almost limitless ways. The Ruby programming language, created by Yukihiro "Matz" Matsumoto, arrived about five years later with the goal of making programmers more productive and trying to make the process of creating software enjoyable. Ruby itself can be used to create graphical user interfaces (GUIS) and is the cornerstone of the "Ruby on Rails" web application framework. Three elements of code syntax that define and differentiate programming languages are: degree of free form, case sensitivity, and statement terminators. Based on these elements Bash and Ruby have a lot in common. Both languages are case sensitive and have no statement terminators. However, Ruby is considerably more free-form than Bash where even a misplaced space can prevent execution of a command p...... middle of paper ......rver). So, we shouldn't be surprised to learn that Bash allows us to run any Unix command in background mode simply by adding an ampersand (&). In this sense Bash appears to support concurrent programming, but only at a very crude level. Ruby, however, offers finer control through Ruby threads. Ruby threads are not true operating system threads but they allow us to emulate them and are quite adequate for most situations where concurrent processing is required. The latest version of Ruby (version 1.9) now offers a feature called "Fibres" which provides additional concurrent capabilities. In conclusion, Ruby seems to offer far superior language features so you can do more with less code. Although one should not forget that the languages themselves have quite different roles and we are really comparing apples to oranges here.
tags