Are there any languages that compile to Bash?

后端 未结 8 1372
夕颜
夕颜 2021-01-30 02:13

I both love and hate writing Bash. I love that it\'s so streamlined for operating on files and working with processes (I agree with this popular question that it\'s way

相关标签:
8条回答
  • 2021-01-30 02:44

    You could also try Batsh, which is a DSL (Domain-Specific Language) that compiles a C-syntax language to Bash (and Windows Batch).

    • Project
    • Online demo
    0 讨论(0)
  • 2021-01-30 02:44

    You might want to give ZSh a try, it has a lot of improvements to make your shell script more readable.

    http://www.zsh.org

    0 讨论(0)
  • 2021-01-30 02:47

    I tried all of the above (results) and started powscript.

    Differences powscript vs the tools above

    • extremely portable preprocessor (100% bash)
    • balances between coffeescript and bash
    • hasslefree portable all-in-one-file compiler/runtime, written in bash
    • loose transpiler: inline bash always possible
    0 讨论(0)
  • 2021-01-30 03:01

    Bish is another option:

    https://github.com/tdenniston/bish

    Shell scripting with a modern feel.

    Bish is a lightweight language created to bring shell scripting into the 21st century. It gives programmers the comfort of modern syntax but compiles to Bash, resulting in good portability (in as much as Bash is portable).

    0 讨论(0)
  • 2021-01-30 03:01

    The problem is that the whole strings-based semantics of Bash is so horribly broken, it'd be pretty difficult to do something like CoffeeScript for Bash.

    Since you probably don't need function-level interoperability to call functions that are written in Bash, you're better off using something entirely different. Perl is close to Bash in being nasty and full of shortcuts and weird syntax, but its semantics are mostly sound. Python is less comfortable for things such as launching processes but is far better for general systems programming, clean and easy to maintain. Python has great libraries and modules for everything; Perl even better.

    0 讨论(0)
  • 2021-01-30 03:01

    You might want to take a look into nscript, in which you can write shell scripts using javascript. All the common bash constructions are in there, like exit codes, pipes, stream redirects, argument expansion, globbing, prompt etc.

    0 讨论(0)
提交回复
热议问题