3 ms·
> Why do this kind of work in the shell It can be quicker & easier to write. Also individually these tools can outperform any code you write by hand. Shells ar
by vlovich123 7y ago
> Why do this kind of work in the shell
It can be quicker & easier to write. Also individually these tools can outperform any code you write by hand. Shells are also common on a far wider range of operating systems than typical programming languages like Python et all. Additionally if you want to improve your productivity you may create your own shortcuts (e.g. "build_myproject" which understands what that entails & may involve some amount of text processing among other things). It's typically far more convenient (shorter, simpler & generally easier to understand) to invoke other programs from shell languages since that's what their programming interface is optimized around.
Sometimes it's good to even wrap the entrypoint for common scripting languages like Python in shell so that, for example, you can setup a virtual environment to run out of or use the proper version of Python.
> Isn't it better to do this in a programming language that can run on all operating systems?
Bash & coreutils have been ported to every operating system under the sun (including Sun operating systems). They're even more common & available than any other programming language that doesn't require a compiler (e.g. `adb shell` will get you into an environment where you can grep & do these operations even though there's generally no python or other scripting language available).
> What are Windows users supposed to do?
* cygwin
* WSL
* Windows ports of Bash (http://win-bash.sourceforge.net/ http://win-bash.sourceforge.net/, https://gitforwindows.org/ https://gitforwindows.org/, etc)
* msys
Let me conclude this post that you shouldn't really write anything complex or maintained by multiple people in shell if you can avoid it and if you can make guarantees about (for example) the available of a Python interpreter. That doesn't mean that shell scripts aren't a valuable and important part of the development ecosystem.