Faculty of Engineering and Mathematical Sciences 
Not logged in (login)


This forum is provided to promote discussion amongst students enrolled in Open Source Tools and Scripting (CITS4407).
RSS cloud
Jump to:

Bash vs Other Programming Languages (eg Python or C)

1 of 390 articles shown, currently no other people reading this forum.
From: Lee dB.
Date: Sun 7th Jun, 4:00pm


"Kerrie Beech" <19*1*3*[email protected]*u*e*t*u*a*e*u*a*> wrote:

> Now obviously I realise that because this is a scripting unit, we are required to use 
> bash to create solutions for the assignments, however in "real life" would it not be 
> easier to create a Python or C program to do the task and then just call it from 
> bash? 
> For example, I think I could create a solution to Assignment 2, Question 3 
> significantly quicker & easier in Python than I did in bash. Now I realise I am much 
> more proficient at Python than bash, hence I am wondering whether it is just my lack 
> of experience in bash which makes it very cumbersome, or whether Python would be a 
> better option? 
> Cheers
> Kerrie

This is something I've been reflecting on myself through the course of
the unit and I think it's a good question. I'm quite fond of Python as
a programming language for a number of reasons. On the other hand, Bash
and shells are something I've previously had exposure to, but I've never
really taken the time to learn them in detail beyond whatever I needed
to know to achieve a particular outcome at the time. For that reason,
I was keen to learn Bash specifically in more detail.

In may ways though, I think that Bash and Python have something
substantial in common - their power comes largely from the collection
of libraries and software that is available in each of  those
environments. Both Bash and Python are interpreted scripting languages
that are dynamic in nature. They also both leverage other projects and
ecosystems for a large portion of their capabilities. In that sense,
both Python and Shell programming are about bringing together disparate
components that have been designed with different philosophies and
objectives to build something new. Contrast that to something like Java
or C#, where the standard library has been developed largely by a single
coordinated entity e.g. Sun. Oracle or Microsoft.

In my opinion, each has pros and cons. Python is much more
platform agnostic than Bash, and Bash (as an example) is much more
anachronistic. Python adopts more modern data structures and paradigms,
whereas Bash feels more like an interactive shell that has grown to
accommodate some programming. Either way, both are still very relevant in
their own ways - Python hasn't (yet) become a mainstream replacement for
a shell, and Bash (probably never will) become a mainstream programming

That being said, Bash and other shells are still the most direct way to
interact with the internals of an operating system. It is a lightweight
glue that can bring together a variety of high-performance executables -
potentially running in parallel - with a common interface regardless of
implementation language. Contrast that with Python where libraries need to
have Python-specific bindings, more than likely share an address space,
and can be difficult to parallelise because of things like the Global
Interpreter Lock.

Would I want to attempt something like Assignment 2, Question 3 in a shell
again? Probably not. I agree it could be implemented more effectively in a
modern language like Python. But having completed the assignments, I can
absolutely see the advantage of shell scripting specifically for certain
use cases, especially where performance and efficiency are required.

Anyway, just my two cents. Would be very keen to hear other's thoughts on the topic!

Related articles

Bash vs Other Programming Languages (eg Python or C) (all 4) RSS
├─ original   Sun 7th Jun, 11:20am, Kerrie B.
├─ THIS   Sun 7th Jun, 4:00pm, Lee dB.
├─ reply 2   Sun 7th Jun, 7:05pm, David M.
└─ reply 3   Tue 9th Jun, 4:50pm, Christopher M.
This Page

Program written by: [email protected]
Feedback welcome
Last modified:  3:57pm Aug 06 2020