5 ms·
I wrote a short book for novices on shell usage, because it is extremely important for developers to know. Bash one-liners are usually even pretty defensible. B
by sethrin 8y ago
I wrote a short book for novices on shell usage, because it is extremely important for developers to know. Bash one-liners are usually even pretty defensible. But I dream about how the world would be if Bash were actually a good scripting language. It compares favorably to csh, and I fear that's about the best you can say for it.
- AceJohnny2 8y ago> But I dream about how the world would be if Bash were actually a good scripting language. It compares favorably to csh, and I fear that's about the best you can say for it. I finally started appreciating Perl after having to write some nontrivial Bash scripts. (My hierarchy is: default to Bash when my task is mostly running commands. If there's a bit of text-processing or regex required, Perl. If I need any hierarchical datastructures, Python)
- sethrin 8y agoI think that the simple expression of this might be that Bash is a command language, not a scripting language.
- nerdponx 8y agoYou might enjoy Zsh.
- 3rdAccount 8y agoHaha, I came to the same conclusions. Perl can do nested data structures, but it ain't easy. With Python, I did it without knowing it was a thing.
- ryl00 8y agoWhat's difficult about hierarchial data structures in Perl?
- vgy7ujm 8y agoAgreed, it's rather one of Perl's strengths.
- AceJohnny2 8y agoThe need for references.
- jonnydubowsky 8y agoI'd love to know more about the book!
- sethrin 8y agoThe focus is on usage as opposed to scripting, and it was written in a few days as a somewhat visceral reaction to seeing a single-page introduction to the shell in a coding academy. It may be that the term "booklet" is more appropriate than "book", and it is certainly the case that "wrote" in the context above should not imply "edited" or "published". However, at the moment I am between projects, and I am very happy to take your interest as a spur to complete this work. However, if you had some time to indulge, I might be able to repay your interest somewhat sooner; having other people review one's final copy is probably the next thing to a necessity.
- MaxBarraclough 8y ago> It compares favorably to csh, and I fear that's about the best you can say for it. Ha. Talk about 'damned with faint praise'. I'm not really in the Unix admin world, but can't you just bite the bullet and use a 'real scripting language' like Python? Other than for things like configure scripts, is the universality of BASH/POSIX really non-negotiable?
- jacobush 8y agoPython has versions
- MaxBarraclough 8y agoPython3 is pretty stable, no?
- jacobush 8y agoIt's starting to get there, recently, so I am hopeful Python can be a good alternative to Bash more often nowadays! There is also the cultural difference. In Python, it's so easy use pip and modules, but if you want something to replace Bash, you need to resist the temptation and only use what's in the standard library. The thing with Bash scripts is that they are often self contained and you can grab a huge snippet of it and it will work pretty much everywhere. (Exceptions of course, the script may do some fancy include or use a program not available, but you get my drift with this.) Bash has been stable a long time, and the Bourne shell compatible part of it for even longer.
- vageli 8y ago> There is also the cultural difference. In Python, it's so easy use pip and modules, but if you want something to replace Bash, you need to resist the temptation and only use what's in the standard library. I don't think it's fair to say that bash programs are not without dependencies, just that the developers (tended to be?) are more thoughtful about portability. For example I've seen scripts that use wget or fall back to curl when it's not available. I've never seen a python script fall back to urllib3 when requests wasn't available on the system.