3 ms·
I write my scripts in Zsh and Python. Maybe once in a while Perl, if I really want Sed but can't figure out the right incantations with branching and the hold s
by nerdponx 5y ago
I write my scripts in Zsh and Python. Maybe once in a while Perl, if I really want Sed but can't figure out the right incantations with branching and the hold space.
Why? Because they are programming languages that have features that I want.
Bash has more features and functionality than Zsh. It's also pretty much ubiquitous. If your scripts are only meant to run on your computer, and you don't need them to work under Busybox or whatever, why constrain yourself to the limited set of features in POSIX sh?
- 1vuio0pswjnm7 5y ago"If your scripts are only meant to run on your computer, ..." is it likely you would be sharing them with others on the web. Thank you for sharing your story. Here's mine. I write scripts in sh. Why? Because it's small, fast and portable. On the OS I use it is not just "pretty much ubiquitous" it is ubiquitous. I have multiple computers running different OS and I want scripts that work on all of them. Some of these computers are resource-constrained and installing additional shells and other interpreters plus libraries is not worth the cost. Anyway, there is no need to do that. If I need scripts that are small, fast and portable, why should I use zsh plus perl or python.
- nerdponx 5y agoConsider that people don't write scripts to work with your system, but with their system. When I see a Ruby script, I don't complain to the author and tell them to use Python instead.
- 1vuio0pswjnm7 5y agoOK, now I understand how you interpreted my comment. Your interpetation is incorrect. I am neither complaining nor telling anyone what to use. I am asking a question. The comparison of Ruby versus Python is a little strange; they are two totally different languages. Bash OTOH is a superset of sh. Same language, with more features. I can usually modify most bash scripts I encounter to run under sh; most do not use the more advanced bash features. That is why I often wonder "Why not sh (for non-interactive use)?" You get better speed and portability and you do not have to install anything.