M
M
Marat Nagayev2021-08-30 15:44:16
linux
Marat Nagayev, 2021-08-30 15:44:16

Why is bash used for shell scripting and not a more modern programming language?

As far as I understand, shells used to be used as primitive high-level languages. Now we have Perl, Python, nodejs, php...
Then what's the point in bash (except for support for legacy scripts, of course), if there is a sys for everything in the axes. calls, and in programming languages ​​- the corresponding wrappers over these systems. challenges.

Answer the question

In order to leave comments, you need to log in

7 answer(s)
S
Saboteur, 2021-08-30
@nagayev

As far as I understand, shells used to be used as primitive high-level languages. Now we have Perl, Python, nodejs, php...

Well, let's give the user Visual Studio instead of the desktop, because what's the difference how to launch the program - with an icon on the desktop, or fork from a high-level language?
shell is the operating system shell. The fact that, in addition to the graphical one, there is also a command line interface is completely normal and adequate. And the shell allows the user and administrator to work in the operating system much more conveniently than through a programming language.
The fact that sh/bash and others are so advanced that they are not bad programming languages ​​in their own right is simply a consequence of the fact that the command interface was created when every user was a bit of a programmer, and the consequence of the fact that cmd line is convenient for automation is simply by its architecture.
Therefore, Powershell, bash/zsh/ksh will continue to evolve.
But you can try to write all the automation in any other programming language. And over time, a little encounter with the fact that a script written in shell 10 years ago just works, and a script written in python 10 years ago is incompatible.

D
Dmitry, 2021-08-30
@dtmse

Try to work interactively yourself and, I hope, everything will immediately become clear:

sudo useradd -m perluser -s /usr/bin/perl && sudo -u perluser -i

sudo useradd -m phpuser -s /usr/bin/php && sudo -u phpuser -i

A
Alexander, 2021-08-31
@Adler_lug

You can also hammer nails with a microscope, but it’s still more convenient with a hammer ...

S
Sand, 2021-08-30
@sand3001

bash is needed for interactive interaction with the system without a graphical interface - like cmd or ps in Windows. Not to mention that bash can be used as a scripting language. If you don't know why you need bash, maybe it's pointless to raise this question?

A
Adamos, 2021-08-30
@Adamos

Here's that rare occasion when you need to remember that Linux is GNU/Linux.
Shell + GNU is, in fact, a high-level LANGUAGE for working with the OS.
Much better adapted to this than any of the universal ones.

L
Linuxoid, 2021-09-09
@orahorn

You cannot put an equal sign between the command shell of the operating system and the programming language interpreter working on the principle of REPL (Read Evelute Print Loop) ...

V
Valentine, 2021-09-10
@ProFfeSsoRr

In general, there was a python, but the point is that "you can't just take it and ..." Well, I remember that someone did it with a python, but I don't even remember the name. Because why should I? I know bash. A young man will come to me and I will show him what I can do. And he will eventually learn Bash too. Well, somehow this has been going on for many years.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question