What is the best (portable and customizable) Scripting shell language today?

I know that this question has good - started "religious" wars in the past and, perhaps, not one correct answer. But after working with ksh and csh for the last 3-4 years and experiencing pain when porting from one to another or applying the general part of the logic to several versions (read as outdated code), if I write a new script, I would go to ksh, but out of compulsion, not out of choice. Is there a better option besides ksh / csh? Also, something that is ported through Unixes (Solaris / HP / IBM / FreeBSD) and Linux (and if I don’t ask too much, or if it makes sense for all Linux accessories)

Waiting for offers ...

World :) Devang Kamdar

+4
source share
6 answers

I would suggest a plain old sh that is available everywhere.

In addition, it is worth noting that portability includes not only the shell, but also other commands used in the script, such as awk , grep , ps or echo .

+8
source

If you really want it to be portable (I don’t know that any shell script is supported), I would specify #! / Bin / sh and test with a dash and, if possible, other shells.

+3
source

I would expect BASH to be the widest distribution shell at the moment, as it is standard for many Linux distributions (it can even work on Windows with cygwin, but this is probably true for other shells as well). An alternative may not be to use the shell itself for scripts, but one of the scripting languages ​​such as perl, python, ruby, ...

+2
source

I usually use ksh. I believe this is a good compromise between features and portability. It is (or a compatible version is available) on most Linux boxes and Solaris. After a while I used HP-UX (fortunately), but I'm sure it was available there.

If all the machines you need for support are up-to-date, bash might be an option. Solaris 10 comes with a copy. This is the default value for most Linux machines.

Your lowest common denominator will be Bourne (sh), so you should consider how important portability is. It skips some of the more friendly functions of ksh and bash, though.

Still worth a look at csh / tcsh for scripting. Csh programming is considered malicious - it's old, but pretty much up to date.

+2
source

My answer will be perl.

Is it possible to do all the "sh" and "w50", etc. more elegant.

And it really is more portable. This version of perl is very convenient for all platforms. There are no significant differences between Linux, Solaris, and AIX distributions, while porting shell scripts between these platforms is a real pain.

And it works on all palms of windows! If you avoid backlinks and "system ()", your script has a good chance of running.

0
source

Python! Check out iPython, which is an advanced Python interpreter. Also: Python for administering a Unix and Linux system .

You can write great portable scripts and it's fun.

0
source

All Articles