Bashism
mywiki.wooledge.org
mywiki.wooledge.org
http://webcache.googleusercontent.com/search?q=cache:MGUqZp5...
https://web.archive.org/web/20130728075247/http://mywiki.woo...
Somehow I got known at work as a guy who knows shell scripting, but people never ask me about simple problems and so I always end up telling them to use Python or C#.
Its less that I don't like shell, but doing complex things in it doesn't scale past a certain point. That and I'd rather use a scripting language than shell. If not that then its time to break out good old C and do it the hard way.
Sure the executable is say 70k versus dunno 5 megs for perl lets say. In the end, if you're that constrained for memory, you should be using c not shell or even perl.
My aversion to shell is more related to finding, and eventually having to support, 20k shell "programs". They are inevitably always brittle creations with no tests or even design philosophy behind them. They nominally were cobbled together to fill a niche. From which I'm impressed they work, but inevitably they fall on their own petard. I've rewritten most of them with some scripting language and reduced their complexity by orders of magnitude and made them easier to use as well as orders of magnitude faster. Stream/pipe processing isn't the only way to skin some cats, despite its simplicity.
I guess I just find the "I know i'll use shell" behavior to really really end up being its own detriment in later use. Shell may be turing complete but things like spaces for example really make using it easily and simply very much a losing proposition compared to say tcl.
I'm not against shell, its a great glue language, but it just seems to get over used in some domains.
Eh, time to go drink I'm rambling aimlessly now.
So (to learn more about it) I implemented a large fraction of the POSIX shell specification. It was rather fun, and fairly easy in any high level language that can call setenv() and fork() and I learned all sorts of interesting things. Example:
FOO=bar cd .; echo $FOO
will output "bar" in a POSIX compatible shell but not bash. Also, this is completely valid: for if in case; do echo {; done
since reserved words are only reserved when in the command position.