2

While going through many answers on Unix & Linux, I came across many of them writing their contents and or tags with POSIX or Bash or some other standard Linux shell.

I know of some differences like some of them have arrays and some do not, and other system level differences which I am not completely aware of.

Question(s):

  • Which one of them is the most widely used?

  • In which should we go into for advanced scripting? (Editor's note: This is opinion-based, so I struck this point out to make this question on-topic here)

What are the things that matter for a Bash script writer to begin scripting in another shell?

closed as too broad by Kusalananda, Vlastimil, muru, user88036, jimmij Oct 4 '18 at 9:30

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. 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.

3

Your question is too big to answer in anything but general terms.

POSIX is a family of operating system interface standards; you generally write code / run utilities in a conformant fashion when you want your application to run across a wide variety of Unix-ish systems. As popular as the GNU binutils and bash are, they are not used universally, so sticking to POSIX-conformant functions, flags and utilities can save you some headaches when the time comes to move an app from say Linux to Mac OS.

"Advanced scripting" isn't descriptive enough to recommend a language, but if what you're doing mostly is running programs and using other program to process the results, the shell is the right tool for that. I don't think it matters much which shell you use, since the usual ones are all portable and can be built and installed along with your app. But if you're using data structures beyond one-dimensional arrays, you should be using a language that more easily manipulates such structures, e.g. Perl.

0

Which one of them is the most widely used?

Bash

is the most popular for common tasks not requiring portability.

POSIX

is the only way to make your script portable.


What portability means

It means to be able to run your script on almost any Linux, and alike-platforms such as Cygwin or Android. Though, be aware that it requires some skill to be able to script POSIX-ly. Examples are out of the scope of this Q & A. Feel free to look around U & L.

-1

POSIX is a standard defining how a POSIX-compliant OS (like linux) should behave/work.

As for shell scripting, "sh" was the default command interpreter, nowadays it is usaully a link to another interpreter (bash, ksh...). The core functionnalities of each of them is the same, but each has their specificities (in terms of functionnality, syntax...).

I think, the most widely used is bash, but this is based on my experience.

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