I've developed a few Bash scripts on a LFS system which should now be made to work on a minimal installation of Sun Solaris 10. Is there a guide somewhere with at least some general tips for conversion, and even better, a "conversion table" for common commands and options? This answer would be a good example of a single entry in such a table.


Search the web for "sun application porting assistant 1.0 final release". I believe it is still downloadable from Oracle web site:

It is a static source code analysis and code scanning tool that can be used to identify incompatible APIs between the Linux and Solaris platforms. Sun Application Porting Assistant's robust C/C++ and shell script parsers are able to examine these source files with reasonable accuracy and produce reports that can be used in porting the application. Together with an easy-to-use GUI and a simple command-line interface, Sun APA is intended to simplify and speed up estimation and porting times.

  • That is exactly the sort of thing we need! It is very low on detail, however - The "Issue Detail" view is empty even though several issues are reported... – l0b0 Jul 22 '11 at 9:08

Check out Resources for portable shell programming.

For Solaris specifically, the biggest gotcha is to make sure you have /usr/xpg4/bin or /usr/xpg6/bin ahead of /usr/bin on your PATH. The utilities in /usr/bin are backwards compatible with the pre-POSIX era. The utilities in /usr/xpg4* are compatible with Single Unix (v2 and v3 respectively). IIRC there are a few shell built-ins that change their behavior depending on the PATH too.

If your scripts are using bash constructs, you'll have to adapt them to run under ksh instead. Bash and ksh have a large common subset that contains many useful features that aren't in POSIX (arrays, extended glob patterns, [[ … ]], <(…), …). You can run ksh on Linux too; most distributions have it as an optional package, and you can download the source from the official site, or from more usable places. The LFS site has installation instructions.

  • Thanks. Bash is installed, so we won't have to port to a different language. – l0b0 Jul 14 '11 at 12:23

The Rosetta Stone for Unix website has a table showing equivalents for common commands across many different *nix flavors, though more focused on users & admins than shell script writers.


Instead of guessing what will work and what won't then just a install a Solaris on your workstation and test it out. (you obviously need a hypervisor to do that - recommend VirtualBox as you can download pre-build images for Solaris for use with VirtualBox). Won't cost you a penny and takes around 30 mins to install. Most of that is download time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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