4 ms·
Well bash does kind of have archaic syntax
by tempxyz 4y ago
Well bash does kind of have archaic syntax
- philipov 4y agoWas there ever a time when that kind of syntax was normal in other languages? Or is it just arcane syntax, that never had a time when other languages were built like it? Maybe the problem isn't that it's old, but just that it's bad.
- Kamq 4y agoBash is trying to mimic algol68 (poorly). Allegedly the guy who created bash had a bunch of C macros that made C more algol68-like.
- GranPC 4y agoYou might be thinking of bsh rather than bash: http://oldhome.schmorp.de/marc/bournegol.html http://oldhome.schmorp.de/marc/bournegol.html
- ncmncm 4y agoNo, that was sh. Steve Bourne. I met him once. #define IF if( #define THEN ){ #define ELSE }else{ #define ELSEIF }else if( #define END } #define WHILE while( #define FOR for( These are described as "non-syntactic macros" and are frowned on these days, but it was the Wild West in the early '70s.
- wisnoskij 4y agoI think it was just cobbled together. I think from the start the shell scripts were a way to arrange and call actual programs. If I remember correctly the first conditionals in shell scripting were literally just calls to the program named "test" I believe or something like that. This resulted in a language with little planning and thought put into it as it expanded to include more and more features. The biggest problem really seems to be that they wanted to avoid the use of esoteric syntax like double quotes and brackets, which resulted in a very unspecific syntax that is continually uncertain of if you are type strings or commands, so we have to use even more quotes and brackets and things of that nature. It really makes me wonder why no one seemed to be working on guiding Linux over to some JIT compiled C scripting like TempleOS uses.
- wruza 4y agoIf I remember correctly the first conditionals in shell scripting were literally just calls to the program named "test" I believe or something like that They still are, in a sense. [ is a synonym for test, and ] is a mandatory no-op argument to it, when used as a “built-in” syntax. You can use [ outside of if as well, like [ <condition> ] && <then-action> test <condition> && <then-action> https://linux.die.net/man/1/test https://linux.die.net/man/1/test