Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 3
    Comeau Computing used to market CCsh, but they’re out of business, and I’m not aware of any other shell compiler. Commented Oct 20, 2020 at 8:45
  • 27
    To be honest, if performance is that big an issue you probably shouldn't be looking at shell scripts in the first place. Commented Oct 20, 2020 at 10:18
  • 12
    @Shadur In addition, many times shell scripts are calling compiled programs that do the heavy lifting, so it's not too much of a boost anyways. E.g., if you have a script that calls awk, sed, and grep, those are all compiled. Commented Oct 20, 2020 at 16:50
  • 5
    @CaptainMan: If you were programming in a compiled language, you'd read the data yourself and use a regex library instead of fork+exec of multiple separate processes, each of which have to pay the startup overhead for a new process, and for dynamic linking (which is a significant part of the total cost for running grep on a short file). Also, for large amounts of data, avoiding piping the data between processes, costing some overall memory bandwidth, and synchronization between cores in the kernel. You wouldn't expect a shell-script compiler to do that, hence Shadur's point: avoid entirely Commented Oct 21, 2020 at 4:12
  • 4
    So essentially the only valid purpose of shc was for people who write insecure code and want to hide their hard coded passwords and vulnerabilities, or script kiddies who are trying to hide obvious malware with the lowest amount of effort possible? Commented Oct 21, 2020 at 21:24