
OOP in Bash - fogus
http://lab.madscience.nl/oo.sh.txt
======
joeyh
You don't need bash features to do this either. I wrote shoop
(<http://shoop.sourceforge.net/>) a decade ago.

<[http://kitenet.net/~joey/blog/entry/ten_years_of_free_softwa...](http://kitenet.net/~joey/blog/entry/ten_years_of_free_software_
--_part_10_shoop/>);

------
skrebbel
Colour me impressed. I thought you needed fancy (relatively) modern stuff like
Ruby for decent in-language DSLs, but clearly Bash can do the trick, too.

I wonder how decent a programming language you could turn bash into using
tricks like these.

~~~
laughinghan
You can in fact write a web framework for Bash using tricks like these: Bash
on Balls has a HTTP parser and router, a model layer that implements OO
similarly to this, even a templating language, esh

<http://news.ycombinator.com/item?id=2781019>

~~~
niklasl
And if you're stuck in the Microsoft ecosystem there is DOS on Dope:
<http://secretgeek.net/dod_intro.asp>

------
btilly
You can do this in straight shell, with polymorphism. See
<http://onestepback.org/articles/poly/sp-shell.html>.

And see <http://onestepback.org/articles/poly/index.html> for the same example
in many, many other languages.

------
astral303
Doesn't look like you can do polymorphism with it, which would be the real
utility of this. Objects are globally named, etc.

But looks fun!

~~~
iam
Why can't you do polymorphism? It looks like he just needs to add vtables to
make that work.

------
mrspeaker
Ha ha! Brilliant. An incredibly suitable domain name for such and insane
monster!

------
kishi
This is bad a joke - not only the classes and methods but the individual
instances have statically generated names. That means in the examples, for the
statically generated "one", "two" and "three" there's no way to assign them to
another variable, or pass them as arguments to a function.

------
timbowhite
I used this to make a utility logging class for bash scripts. It prints nicely
formatted messages to the console and/or logfile. The format is similar to
Linux boot messages.

<https://github.com/timbowhite/bashtasklog>

------
supernayan
Have bash skills?

<http://blog.audaxhealth.com/jobs>

------
smogzer
does anybody know if it works for zsh also ?

------
jpr
There's insanity, and then there's this...

