I both love and hate writing Bash. I love that it\'s so streamlined for operating on files and working with processes (I agree with this popular question that it\'s way
Since I originally asked this question, two projects have been released which attack this problem and do a pretty good job. Both reimplement many/most Unix tools in more programming-friendly runtimes.
Plumbum is implemented in Python and looks pretty solid:
http://plumbum.readthedocs.org/en/latest/index.html
ShellJS is implemented on Node.js and also looks pretty good:
https://github.com/arturadib/shelljs
Exciting developments! I'm looking forward to trying them out. If you already have, it'd be great to hear your experiences in the comments. Thanks!
I recently developed a language called BashClass which is Object Oriented, has type checking and allow multi-dimensional arrays. The language syntax is inspired by different programming languages.
Here's an example on how a List
class is implemented (Full example here):
class List extends Object {
var Object[] data = new Object[];
var int size = 0;
constructor List(){
super_constructor();
}
function void add(var Object object) {
data[size] = object;
size = size + 1;
}
function void pop() {
if(size == 0) {
exception("Cannot remove element from an empty list");
}
size = size - 1;
data[size] = null;
}
function int size() {
return size;
}
function Object get(var int index) {
if(index < 0 || index >= size) {
exception("Cannot access element out of bound");
}
return data[index];
}
}
Classes and multi-dimensional arrays in BashClass are converted to Bash 4.4 associative arrays. The language is at its first release and is open source on Github. Feel free to contirbute and suggest features.