3 ms·
Sometimes shell is the only thing you can guarantee is available and life is such you have to have portability, but in general, if you've got an enormous shell
by eschneider 2y ago
Sometimes shell is the only thing you can guarantee is available and life is such you have to have portability, but in general, if you've got an enormous shell app, you might want to rethink your life choices. :/
- norir 2y agoI hear this fairly often and I'm genuinely curious how often you have shell but _not_ a c compiler or the ability to install a c compiler via the shell. Once you have a c compiler, you can break out of shell and either write c programs that the shell script composes or install a better scripting language like lua. At this point in time, it feels quite niche to me that one would _need_ to exclusively use shell.
- bhawks 2y agoThere are plenty of contexts where you won't have a compiler today - embedded (optimize for space) and very security hardened deployments (minimize attack surface). Historically people used to sell compilers - so minimizing installation to dev machines probably was a savings (and in those times space was at a premium everywhere). That said - I am with you, give me any other programming language besides shell!
- chubot 2y agoThat's what I thought -- I thought that OS X was the main Unix where it is "annoying" to get a C compiler (huge XCode thing IIRC), and it isn't used for servers much. But people have told me stories about working for the government (my background was more "big tech", and video games, which are both extremely different) Some government/defense systems are extremely locked down, and they don't have C compilers So people make do with crazy shell script hacks. This is obviously suboptimal, but it is not that surprising in retrospect!
- mdaniel 2y ago> it is "annoying" to get a C compiler (huge XCode thing IIRC) FWIW, there is an apple.com .dmg "command line tools" that is much smaller than Xcode formal, but I actually came here to say that to the very best of my knowledge a $(ruby -e $(curl ...)) to brew install will then subsequently download pre-built binaries from GitHub's docker registry
- GuB-42 2y agoThe problem is: which shell? Bash is far from being universal. Also, there is usually not much you can do with a shell without commands (find, grep, sed, cat, head, tail, cut...), and commands have their own portability issues. Targeting busybox may be your best bet, but once you are leaving your typical Linux system, writing portable (Bourne) shell scripts becomes hard to impossible.