5 ms·
Bash is the love of my life! I have been working for years on this problem now (not full-time of course), gradually moving in the direction of finally being abl
by gizi 10y ago
Bash is the love of my life! I have been working for years on this problem now (not full-time of course), gradually moving in the direction of finally being able to challenge this:
"Inappropriate use
shell is the main domain specific language designed to manipulate the UNIX abstractions for data and logic, i.e. files and processes. ... Correspondingly, please be wary of writing scripts that deviate from these abstractions, and have significant data manipulation in the shell process itself. While flexible, shell is not designed as a general purpose language and becomes unwieldly when ... "
Another person has actually solved the most important show stopper already: http://ctypes.sh http://ctypes.sh.
What now remains to be solved, are a few minor, additional details, and then simply writing a good manual of how to very successfully use bash as a general-purpose language.
My personal belief is that everything that you can do in other scripting languages, you can also do in Bash, only better.
- nerdponx 10y agoYou're missing out on Zsh ;)
- daveguy 10y ago> My personal belief is that everything that you can do in other scripting languages, you can also do in Bash, only better. Matrix multiplication?
- mbrock 10y agoEffective bash programming involves invoking other Unix commands. That's what the shell is for, after all. I don't know off the top of my head what you'd use for matrix multiplication; I guess it depends. For another example, jq and jshon are excellent tools for querying, transforming, or creating JSON values. My experience is that programming by composing Unix programs that communicate via pipes and files can be very pleasant and productive. Sometimes I lament aspects of bash syntax and semantics, but it's also much more convenient than other scripting languages for tasks related to spawning programs and pipelines and working with files. One of my recent projects that I've been having a lot of fun with is a kind of continuous integration system built mostly with bash scripts. It involves a lot of calls to git and Docker, process manipulation, file descriptor redirection, and file system manipulation—and bash makes all this pretty easy and concise.
- majestik 10y agoOk, I'll bite. >> My personal belief is that everything that you can do in other scripting languages, you can also do in Bash, only better. 1) Native JSON, XML 2) Classes, namespacing, objects 3) Multiprocessing, multithreading 4) Performance 5) Package management 6) Portability 7) Documentation 8) Runtime debugging (!set -x) I'm too tired to continue.
- pwd_mkdb 10y agomy personal belief is that anything one can do in bash i can do in sh. not sure if that's really true in practice, but that's my belief. i never use bashisms because i do not know what they are or how to use them.
- brbsix 10y agoYou're just having a laugh at the OP, right? In case you're not, here are some "Bashisms" that really suck to be without: * built-in regex support (e.g. `[[ $var =~ ^1\.2\.[34]$ ]]`) * process substitution (e.g. `diff <(before_command) <(after_command)`) and all sorts of other redirection tricks * indexed and associative arrays Some of this can be worked around by shelling off to grep for regular expression matching or awk for arrays, but Bash makes things so much cleaner and maintainable.
- cm3 10y agoBut once you adopt bash-only features, you're losing the main argument for a shell script: portable scripting without the need to first install something to get something else running. Once you require Bash, it's equally easy to demand Perl and that will provide a much richer scripting experience.
- bogomipz 10y agoWhen it this last time you logged into a box and /bin/bash wasn't an option? Let me guess 1999 on a SPARC box running Sun Solaris?