2

Nowadays, I'm researching for performance tuning for shell scripting , And I have been prevented to POSIX shell scripting, However it's only a standard, But I think it's rathar than standard for do it. It has been customized , It has been tuned, And finally it earned high performance. I think you can help me/us to create a thread to help for POSIX shell scripting. My questions are :

  1. Does POSIX shell scripting has high performance related to other shell programming?
  2. How can I migrate to POSIX shell scripting?
  3. Is't possible to bare my code to only POSIX?
  4. If you prefer to high performance without POSIX, Can you illustrate it?

closed as unclear what you're asking by jasonwryan, Stephen Kitt, Michael Homer, slm May 26 '15 at 22:03

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

5

The Problem

It is common for students to have portability problems with their scripts when they do their initial development on systems that use bash, for example, as /bin/sh. While bash supports all functionality in the POSIX standard, it also supports a wide range of extended functionality that is not defined by POSIX. When a script is written to use such 'bashisms', it is not guaranteed to run correctly when /bin/sh is some other POSIX compliant shell. On nice.harvard.edu, which is an Ubuntu system, /bin/sh is dash, a shell that runs much faster than bash, but does not support functionality beyond that specified by the POSIX standard. Students who have used 'bashisms' in their scripts discover, often at the last minute, that their scripts will not run under /bin/sh on nice.

The Solution

Here are a few tips to help you avoid such problems:

  • always develop scripts on nice with /bin/sh if possible
  • install a strict POSIX shell (such as dash) on your personal system for development purposes
  • only use functionality specified here when developing shell scripts
  • view this document to get tips on recognizing and replacing 'bashisms'
  • view the full documentation for autoconf ('info autoconf.info'), which has a good section on 'Portable Shell' programming

See this for more information.

Not the answer you're looking for? Browse other questions tagged or ask your own question.