matt-daemon
stars in jsonbash
— the JSON Bourne Again shell.
(Image based on this.)
TODO
TODO
Linux ladies love installing
matt-daemon
...
finger
mount
unzip
strip
touch
more
yes yes
TODO
OK, you got me, it's not JSON (at least insofar as JSON isn't JavaScript).
To quote from the original projects[1][2][3]:
I'm not sure what the [jsonbash] project does yet, but I'm pretty excited about the name.
Yeah.
#!/usr/bin/env node
Yep.
AFAICT, yes.
Idunno, for fun I guess?
But it was prompted by Apple switching the default shell from Bourne Again Shell (GNU Bash) to Z shell as of macOS Catalina (10.15).
This change in macOS was perhaps due to the licensing of GNU Bash: version 4 (2009) and later have been licensed under GPLv3, whereas version 3 (2004) was licensed under GPLv2. One motivation behind version 3 of the GPL was to restrict Tivoization, whereby vendors of hardware (e.g. TiVo) would incorporate copyleft-licensed open-source software into their products, but use hardware restriction (such as digital signatures) to prevent modified versions of that software from running on those products — arguably defeating the copyleft purpose of the license as far as that hardware is concerned. Even though GNU Bash is already at version 5 (2019), macOS still ships with version 3.2.57 (2007), which was the last version of GNU Bash licensed under GPLv2. So maybe Apple is gearing up to implement some kind of Tivoization for their own hardware products? To do so, they couldn't include any GPLv3 code in macOS, which might explain why GNU Bash is stuck at 3.2.57.
But according to http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/, Apple has been removing specifically GPL-licensed software packages as of Mac OS X Leopard (10.5) (or earlier?):
macOS version | Number of GPL-licensed packages |
---|---|
10.5 — Leopard | 47 |
10.6 — Snow Leopard | 44 |
10.7 — Lion | 29 |
10.8 — Mountain Lion | 22 |
10.9 — Mavericks | 19 |
10.10 — Yosemite | 18 |
10.11 — El Capitan | 16 |
10.12 — Sierra | 16 |
Maybe that's a coincidence and this is speculation, but the switch to Z shell as the default could foreshadow GNU Bash's eventual removal from macOS entirely. It's bad enough that it's already a decade out-of-date, but IMHO, the complete loss of bash
would be unfortunate for developers on macOS and for interoperability between operating systems generally.
To be fair, Apple doesn't seem to be backing away from open-source; on the contrary, they appear to embrace it, for example, as stated at https://developer.apple.com/opensource/:
Open source software is at the heart of Apple platforms and developer tools, and Apple continues to contribute and release significant quantities of open source code.
And I concur, based on some of the open-source projects listed there, or previously hosted at macOS forge:
Project | License |
---|---|
![]() |
Apache (2.0) |
![]() |
Apache (2.0) |
![]() ![]() |
Apache (2.0) |
![]() |
APSL and others |
![]() |
BSD (3-clause) |
![]() |
Apache (2.0) |
![]() ![]() |
LGPL (2.1) BSD (2-clause) |
![]() |
APSL (2.0) |
XQuartz — ![]() ![]() |
BSD, MIT, variants APSL (2.0) |
But most of those licenses are permissive, which would permit Tivoization. I generally favour permissive licenses, and I don't have a problem with Tivoization per se — in other words, if I don't like that a particular hardware is restricted to a particular software, then I simply won't buy that hardware. But when it comes to personal computers (and maybe even smartphones), one of my expectations is the freedom to choose what software I use on that computer. In other words, for a general purpose computer with a given CPU architecture, I should be free to run any operating system I choose (for which I have obtained a valid license) that can be built for that architecture. (Assuming, of course, availability of device drivers for that operating system.) So if Tivoization is in the future for Macs, it would be a real disappointment to me.
So if we have to switch to a different shell anyway, then why not try one in JavaScript, especially with its growing popularity for application development, not to mention its ubiquitous use on the Web?
Fortunately, Matt Daemon (April 2012) has already been developed. This is not to be confused with later Matt Daemons, such as:
mattd — Matt Daemon (2013):
- Forked from mattd.core.
-
$ service mattd status
Matt Daemon is running.
$ service mattd stop
You can't stop Matt Daemon. Permission denied. [FAILED]
matt-daemon (2017):
- A Node.js HTTP daemon for serving static files from a directory.
-
With Matt Daemon, there are no surprises. He just serves.
The original Matt Daemon was forked and developed into the Jason Bourne shell, which was itself forked and developed into the JSON Bourne shell. Unfortunately, the source code for these projects is currently published without a license, and therefore may not be used by anyone other than their respective copyright holders, as mentioned in GitHub Help:
...without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work.
This situation might be similar to that of the original Bourne shell, whose copyright may be disputed as part of Unix. This perhaps contributed to the development of the Bourne Again shell as an open-source replacement under GNU. Similarly, we have developed the JSON Bourne Again shell to provide a licensed alternative to the Jason Bourne shell and JSON Bourne shell (and Matt Daemon) via a complete re-write, so that none of the unlicensed code remains.
...Perhaps along the lines of csh
/tcsh
for C.
#!/usr/bin/env ____
- C#:
csharp
: https://www.mono-project.com/docs/tools+libraries/tools/repl/scriptcs
(2018): https://github.com/scriptcs/scriptcsdotnet-script
: https://github.com/filipw/dotnet-scriptNake
(2017): https://github.com/yevhen/Nakecsi
: https://docs.microsoft.com/en-us/archive/msdn-magazine/2016/january/essential-net-csharp-scripting
- JavaScript:
- V8 (Chromium):
- SpiderMonkey (Mozilla):
- JavaScriptCore (Safari)
jsc
: TODO
- Perl:
perl -de1
: https://perldoc.perl.org/perl.htmlpsh
(2007): https://metacpan.org/pod/distribution/psh/doc/psh.pod
Other things with similar names — and things related to those things — none of which are related to jsonbash:
ShellJS: Implements some
bash
commands for use in JavaScript.shx: Run ShellJS commands directly on the command line.
-
Cash: Implements some
bash
commands in an interactive shell running on Node.js. The commands can also be used in JavaScript scripts. (Implemented using Vorpal.) -
jssh — JavaScript Shell: An interactive JavaScript shell that runs on Node.js. Also supports
bash
commands via ShellJS.
-
yargs: Parses command line arguments and options; also provides a help system and command completion. ☠
-
commander.js: Enables you to define the arguments and JavaScript code for a CLI command; when the command is run, commander.js parses the arguments and executes the code.
-
Inquirer.js: Provides an interactive CLI by enabling you to implement prompts to the user.
-
Vorpal: Based on commander.js, it uses chalk for styling, minimist for argument parsing, Inquirer.js for interactive prompts, and implements its own help system and command completion to provide a complete interactive CLI app package (e.g. Cash). 🗡️
-
JSON.sh: Parses JSON in POSIX shells.
-
json-bash — JSON for Bash: Processes JSON data in
bash
. -
JSON.sh: Parses JSON in various Unix shells based on the Bourne shell (
ash
,bash
,dash
andzsh
). -
jsonsh.com — JSON Syntax Highlight & Format: Online formatting and syntax-highlighting of JSON data (copied-and-pasted, or directly from a web-service URL).
node
— Node.js.npm
— Node Package Manager.yarn
— Node.js package manager (using npm repository) from Facebook.n
— Node.js version manager.nvm
— Node Version Manager.nvs
— Node Version Switcher.
- Gecko, Quantum/SpiderMonkey (Mozilla):
- Firefox and derivatives.
matt-daemon — Matt Daemon (April 2012)
mattd.core — Matt Daemon (August 2012)
mattd — Matt Daemon (2013)
matt-daemon — Matt Daemon (2017)
matt-daemon — Matt Daemon (2019)
jason-bourne-shell — Jason Bourne shell (2016)
json-bourne-shell — JSON Bourne shell (2017)
- Reddit/ProgrammerHumor post by u/lmalmen (2017).
- Tutorial to Native Node.js Modules with C++. Part 2 — Arrays, JSON and Callbacks by Vincent Mühler (2017).
- Twitter comment by Hersmut (@scherzmut) (2018).
- Tweet by Steve Parker (@unixsteve) (2018).
Licensed under the MIT License. See LICENSE.md.
Copyright © 2020 jsonbash authors and contributors.