Ruby against Bash

940 Words2 Pages

Comparing and contrasting the Bash Shell scripting language with the Ruby Programming language At 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 so different and what might they have in common? This documents aims to answer these questions. The 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 (primarily installed on Linux based systems). Bash scripts are created with an editor and are run with the Unix sh command. The Bash language itself is highly procedural, supporting shell variables and procedural constructs such as ifs and loops. Bash provides an excellent medium for combining Unix commands and their outputs in almost limitless ways. The Ruby programming language which was devised by Yukihiro "Matz" Matsumoto, arrived approximately 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-formness, case-sensitivity, and statement terminators. Based on these elements Bash and Ruby have quite 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 poorly placed space can prevent a command from executing p... ... middle of paper ... ...rver). So, we should not be surprised to learn that Bash allows us to run any Unix command in a background mode simply by appending an ampersand (&). In this sense Bash does appear to support concurrent programming, but only at a very coarse-grained level. Ruby however, offers finer control through Ruby threads. Ruby threads are not true operating system threads but do 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 ‘Fibers’ which offer further concurrent abilities. In conclusion then, Ruby does appear to offer vastly superior language features whereby more can be accomplished in less code. Although it should not be forgotten that the languages themselves have quite different roles and we really are comparing apples with oranges here.

Open Document