OddThinking

A blog for odd things and odd thoughts.

Bashing bash

Today, Twitter was awash with people talking about Linux on Windows.

It took a few hours before I got around to finding out what they were talking about. Microsoft is bringing the Bash shell to Windows 10:

Here is an announcement from Microsoft Build you probably didn’t see coming: Microsoft today announced that it is bringing the GNU project’s Bash shell to Windows. Bash (Bourne Again SHell) has long been a standard on OS X and many Linux distribution systems, while the default terminal for developers on Windows is Microsoft’s own PowerShell.

More importantly than bringing the shell over to Windows, developers will now be able to write their .sh Bash scripts on Windows, as well (or use Emacs to edit their code). Microsoft noted that this will work through a new Linux subsystem in Windows 10 that Microsoft worked on with Canonical.

Let’s put aside that Emacs has been running on Windows for decades (okay, I can only prove it back to 2007, but I am sure I used it – and discarded it as silly idea – earlier), and that I have often written bash commands in Windows, even if I run them on Linux.

I am still having trouble caring about this announcement. Every time I try to write a bash (or batch file or Powershell) script longer than about five lines, I realise my mistake and rewrite it in Python, where it is cleaner, safer and more portable. (If you want to replace “Python” with “Ruby” or your favourite modern scripting language, that’s fine too. I am not defending Python here, I am bashing bash.)

Microsoft may as well tell me that they are going to support those old Sun mice that required the special gridded mouse mats. Why would we want to go back to that?


Comments

  1. Is this just a rebranding of the old Microsoft Windows Services For Unix (SFU) product? Remember that? Even if not, there’s still cygwin and mingw and possibly other ports which make the bash-on-windows not novel. Less “bash is coming” more like “another bash is coming”.

    I partly agree with you about bash but – as always – I prefer to blame lazy developers who can’t be bothered to learn to use it properly. I’ll take well-written bash over spaghetti python any day.

    Case in point. Rando asks: how do I regex in bash? Three crappy answers, 50-something upvotes, and FOUR YEARS pass before finally someone pipes up with the fact that bash supports regexes natively and simply…

    … unlike python 🙂

  2. I could never work out whether Windows Services for Unix ran on Unix or Windows. I’ve posted before about how I was treated by cygwin, and prefer not to relive that experience.

    To be fair, Python supports regex out-of-the-box, but you are right. It isn’t part of the core language.

    I can’t argue that “well-written bash” doesn’t actually exist, in the same way I can’t argue that Russell’s Teapot doesn’t actually exist. I can argue that I never managed to write a well-written bash script with a McCabe complexity of greater than two.

  3. Is this just a rebranding of the old Microsoft Windows Services For Unix (SFU) product? Remember that?

    Yes (I remember) and no (it isn’t).

    Even if not, there’s still cygwin and mingw and possibly other ports which make the bash-on-windows not novel.

    It’s not bash-on-Windows, even if everyone is reporting it as such.

    It’s any-Linux-binary-on-Windows, i.e. a sort of inverse of Wine. (Except, instead of having to faithfully port a giant API and all the libraries, like Wine must, the Microsoft version only needs to emulate a bunch of syscalls and gets everything else for free.)

    As such, yes it is novel.

  4. Thanks for the clarification, and I agree that Linux-binary-on-Windows is certainly novel. Is it useful?

    And not to over-reach on bash vs python, may I present this as an example of a relatively powerful technique which is supported in bash. What would the equivalent look like in python, I wonder?

  5. I agree that Linux-binary-on-Windows is certainly novel. Is it useful?

    Well, it seems comparable to MinGW, an equivalently but differently native way of getting the Unix toolbox on Windows. So the answer to that question is probably equivalent to whatever you would answer to “is MinGW useful?”.

    I don’t know if I’ll ever need to something on Windows, and if that’ll be Windows 10, but should I ever find myself in that quandary (☺), I presume it will become useful to me at some point. I cannot say whether this or MinGW will be the better option, though.

    What would the equivalent look like in python, I wonder?

    I left a comment with a likely way of porting it over there.

  6. Hey! That was supposed to be a Unicode smiley.

Leave a comment

You must be logged in to post a comment.