Ambitions for a Unix Shell
Mostly off topic, but I&#x27;ve never understood why shells are designed to have this weird dual use case of both being easy to type into a command prompt, and being easy to write 40+ line scripts in. Why does that need to have the exact same syntax? This is the root cause of why bash (and batch and etc etc etc) are so terrible to script in (and why powershell is so terrible to type into a terminal). This weird shit like [ being a command, and having to think long and hard about exactly when variables are replaced and when globs are executed and how errors happen.. It&#x27;s just pretty pointless.<p>Like, if you write a script using Python or Ruby or Perl or whatever, there&#x27;s easy ways to call into the shell. Often it&#x27;s even built-in, like using backticks `echo like this`. These languages aren&#x27;t designed for shell scripting but even they are often easier and cleaner than a bash script. It could be much better thoughk I bet.<p>I&#x27;d love to have a language that is easy and familiar to type into a terminal (and thus, sufficiently bash-like probably), while being significantly easier to write scripts in. You could require the script to have a bit more syntax, a bit more structure, but essentially have the same semantics as what you&#x27;d type on the command line, and you&#x27;d have the best of both worlds. If well designed, it&#x27;d still &quot;feel&quot; like the same thing (much like how all JS programmers immediately grokked Coffeescript when it came out, because it really was just JS); everything you&#x27;d learn on the command line, you&#x27;d be able to apply in a script and vice versa. The script would just require more structure and thus provide more comfort (good error messages, editor support, etc).<p>For example, globbing. The idea that the shell expands &quot;<i>.foo&quot; into a list of files, before evaluating the command, is handy, but it&#x27;s also an enormous footgun. What if on the terminal it would do that, but when scripting, you&#x27;d be required to write `glob(&quot;</i>.foo&quot;)` or else it&#x27;d error out? THat would force you to clearly control when the expansion happens, it would let you assign it to a variable in a readable way etc. Imagine similar stuff for argument lists, escaping, variable substitution, etc - all the magic available on terminal, but contained in the script.<p>Does this exist? I&#x27;d love to have it.