(no title)
gizi | 9 years ago
"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.
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.
majestik|9 years ago
>> 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.
int0x80|9 years ago
IMO shell makes it very easy to work with multiple process (&). It's built in and natural.
>4) Performance
If you are carefull and know what you're doing, you can achive very good performance with the shell. Usually, better performance is achived processing less data, ie being inteligent. Rarely depends on the language (unless you care about cycle level performance, then yes :).
>6) Portability
I claim that it's way easier to depend on sh being on a (UNIX) system than $SCRIPTING_LANG.
>7) Documentation
?? You can mess up documentation in any language.
pwd_mkdb|9 years ago
daveguy|9 years ago
Matrix multiplication?
mbrock|9 years ago
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.
nerdponx|9 years ago