You are not logged in.

#1 2022-04-09 19:09:43

junux
Member
Registered: 2021-10-21
Posts: 10

Why arch written in bash

Arch is an OS that almost 100% if it is written in bash programming language.
I was curious to know why?
Is there any advantage for bash here? For example, why not use Python or C? I don't want say that they're better technologys or something like that. But Despite the inherent differences that these languages have, was there any specific reason for choosing bash?

Offline

#2 2022-04-09 19:14:35

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Why arch written in bash

junux wrote:

Arch is an OS that almost 100% if it is written in bash programming language.

Some of the Arch specific scripts are written in bash but these aren't usually things that require a more performant language. Ease of maintenance and contribution can be more important than saving the odd millisecond here and there.
Are there any specific utilities that you are thinking of? One of the best Arch utilities (pacman) is already written in C. The archinstall script is python. What do you think could be improved by switching to a different language?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2022-04-09 19:18:15

jbmelberg
Member
Registered: 2022-04-09
Posts: 4

Re: Why arch written in bash

Can you clarify what you mean by "Written in bash"?

The GNU/Linux kernel is written almost entirely in C, going to https://github.com/archlinux/linux/ shows us that 98.3% of the project is written in C.

Offline

#4 2022-04-09 21:43:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,330
Website

Re: Why arch written in bash

junux wrote:

Arch is an OS that almost 100% if it is written in bash programming language.

No.  This is completely false.  Did you see this in an article published 8 days ago?

Bash is the default interactive shell in arch.  But that's true of a very wide range of other distros (I'd bet the vast majority of distros even).  Bash is also far too often assumed, or required by scripts that really shouldn't need bash specifically - this is a personal pet peeve of mine - but this too is not an issue exclusive to arch linux (in my experience, the *buntus are worse in this regard).

Makepkg is a bash script (or set of bash scripts).  And that is a (mostly) uniquely arch bit of software.  But it's definitely not 100% of the OS ... one would have to have a pretty liberal definition of "OS" for it even to be included in that.

Last edited by Trilby (2022-04-09 21:49:20)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2022-04-10 10:55:45

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,482
Website

Re: Why arch written in bash

I'm guessing this is based on PKGBUILDs being all bash.  And so stats on Arch code will be heavily skewed there.

What is packaging apart a wrapper around running a set of shell commands to build software?  What better language to run a series of shell commands in than bash?  There have been proposals to use other approaches/languages for PKGBUILDs to better specify packaging dependencies etc.  But plain bash gives so much flexibility!

Offline

#6 2022-04-10 11:32:24

Awebb
Member
Registered: 2010-05-06
Posts: 6,640

Re: Why arch written in bash

Allan, how about a pacman rewrite in bash?

Offline

#7 2022-04-10 13:07:35

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,129
Website

Re: Why arch written in bash

Awebb wrote:

Allan, how about a pacman rewrite in bash?

I'd prefer haskell. Then we'll get frequent pacman updates due to new ABI releases.

Last edited by schard (2022-04-10 13:07:57)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

#8 2022-04-11 04:40:01

junux
Member
Registered: 2021-10-21
Posts: 10

Re: Why arch written in bash

Slithery wrote:

What do you think could be improved by switching to a different language?.

i did not do any research or testing, so I prefer to don't repeat the buzz that is all over the net

Last edited by junux (2022-04-11 04:40:46)

Offline

#9 2022-04-11 04:42:52

junux
Member
Registered: 2021-10-21
Posts: 10

Re: Why arch written in bash

jbmelberg wrote:

Can you clarify what you mean by "Written in bash"?

The GNU/Linux kernel is written almost entirely in C, going to https://github.com/archlinux/linux/ shows us that 98.3% of the project is written in C.

No, I didn't mean the kernel, was talking about Arch scripts.

Offline

#10 2022-04-11 04:54:09

junux
Member
Registered: 2021-10-21
Posts: 10

Re: Why arch written in bash

Trilby wrote:

Bash is the default interactive shell in arch.  But that's true of a very wide range of other distros (I'd bet the vast majority of distros even).  Bash is also far too often assumed, or required by scripts that really shouldn't need bash specifically - this is a personal pet peeve of mine - but this too is not an issue exclusive to arch linux (in my experience, the *buntus are worse in this regard).

Makepkg is a bash script (or set of bash scripts).  And that is a (mostly) uniquely arch bit of software.  But it's definitely not 100% of the OS ... one would have to have a pretty liberal definition of "OS" for it even to be included in that.

oh, I agree, it's a little tricky to separate and label different parts of an OS in Linux based systems.

Trilby wrote:

No.  This is completely false.  Did you see this in an article published 8 days ago?

no I didn't, do you have an address about it?

Offline

#11 2022-04-11 11:23:58

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Why arch written in bash

junux wrote:
Slithery wrote:

What do you think could be improved by switching to a different language?.

i did not do any research or testing, so I prefer to don't repeat the buzz that is all over the net

Can you provide any links to this 'buzz that is all over the net'? I haven't seen any.

junux wrote:
Trilby wrote:

No.  This is completely false.  Did you see this in an article published 8 days ago?

no I didn't, do you have an address about it?

8 days ago when Trilby posted was April Fools day...


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#12 2022-04-11 12:39:34

mpan
Member
Registered: 2012-08-01
Posts: 1,344
Website

Re: Why arch written in bash

junux wrote:

No, I didn't mean the kernel, was talking about Arch scripts.

Because some kind of shell must already be present in the system. So why not use it?

Last edited by mpan (2022-04-11 12:42:01)


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#13 2022-04-11 12:41:58

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,182

Re: Why arch written in bash

This is really setting off my troll alarm.

Offline

#14 2022-04-11 14:34:21

seth
Member
Registered: 2012-09-03
Posts: 59,897

Re: Why arch written in bash

My first guess was that we're being asked to do somebodies homework ("Describe the differences between C and bash. List 10 pros and cons of each. In what context is C/bash the better choice?")
The question is vague and the premise wrong … sounds like a school teachers inquiry tongue

Online

Board footer

Powered by FluxBB