Essay on Ruby against Bash
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 …show more content…
Perhaps the most glaring difference between Bash and Ruby is the fact that Ruby is a pure object oriented language, whereas Bash is not. In Ruby everything is considered some kind of object even numbers. Ruby implements all the features that a programmer might expect to see in any modern object oriented scripting language such as inheritance, encapsulation, and polymorphism. Curiously though Ruby has no abstract classes or interface types. Ruby uses 'modules' to address this apparent deficiency though.
Variable typing is quite different in the two languages. In Bash, variables are not really considered to have any given type and mostly they act to hold some string value. Shell variables do not need to be declared prior to their use, although their scope can be limited with the Bash 'local' keyword. As for Ruby, variables do have specific types. Ruby makes use of 'Duck typing'. Duck typing comes from the expression 'If it walks