4 ms·
Tangential question, but are there any efforts to treat shell scripts as a compilation target? It seems like such an insane language, I don't know why another n
by faitswulff 8y ago
Tangential question, but are there any efforts to treat shell scripts as a compilation target? It seems like such an insane language, I don't know why another nicer language hasn't emerged on top of it.
- codetrotter 8y ago> It seems like such an insane language I wouldn’t say insane, just limited. But the main point of the shell and of scripting the shell is to execute programs and creating pipelines. If you need to do complex things, or you need special data structures or you need to process the output directly yourself in any significant way, then shell scripting is simply not the right tool for the job. And in the case where you want to use another language why do you want to transpile to shell script? Better to just install Python 3 or something on the server. (It might even be installed there by default already.)
- freedomben 8y ago> It seems like such an insane language I can understand that because I thought that way too before I really learned it. Bash is a language like any other: it takes reading and practice to get good at it. Also most of the WTFs in Bash actually make decent sense when you consider that whitespace is the delimiter in bash (for example setting a variable is VAR='value' instead of VAR = 'value'. That trips newer people up pretty badly at first). Most people also abandon good software practices when they write bash for some reason. For example, you'd never write 100 lines of ruby or javascript without declaring functions, yet people do that all the time in bash (they shouldn't). If people followed good practice, I think bash would seem a lot less insane.
- nicoburns 8y agoI think lack of proper arrays and structured data types is a big issue with bash. Basically everything is a string, with all the issues around escaping and corner cases that that implies
- freedomben 8y agoYeah very fair. I actually thought I included a line like this: "If you need arrays, hashes, or floating point math then bash is a poor choice" but I must have deleted it (I've been trying to use more brevity when I write).
- JetSpiegel 8y agoBash (4 at least) has proper arrays and hash maps, but granted, the syntax is hideous. The arrays are also limited, but hash maps are somewhat sane. > declare -a ARRAY > declare -A MAP