Why not use bash by default?

Status
Not open for further replies.
If you want something as versatile as bash without all of the baggage (read: dependencies that may lock you out of your login shell over ssh after an upgrade), try shells/mksh. Be sure to copy /usr/local/share/examples/mksh/dot.mkshrc to the shell user's ~/.mkshrc).

For scripting, it's /bin/sh all the way, but for an interactive shell, mksh is very pleasant.
 
If you want something as versatile as bash without all of the baggage (read: dependencies that may lock you out of your login shell over ssh after an upgrade), try shells/mksh. Be sure to copy /usr/local/share/examples/mksh/dot.mkshrc to the shell user's ~/.mkshrc).

For scripting, it's /bin/sh all the way, but for an interactive shell, mksh is very pleasant.
mksh-website
 
For scripting, it's /bin/sh all the way...
Some of the things that can be accomplished in POSIX shell are wild. I am looking forward to picking up some new tips from dteske's upcoming book on this topic. Having said that, I must admit some bashisms (or zshisms) would make some things safer and easier. One example is local. Maybe it's not the best example, because it's actually supported in FreeBSD's /bin/sh, but it is not part of POSIX.
 
If you want something as versatile as bash without all of the baggage (read: dependencies that may lock you out of your login shell over ssh after an upgrade), try shells/mksh. Be sure to copy /usr/local/share/examples/mksh/dot.mkshrc to the shell user's ~/.mkshrc).

For scripting, it's /bin/sh all the way, but for an interactive shell, mksh is very pleasant.

Do you maybe know a shell with less than 40-100 lines of codes? That would be really cool and likely bug free ;).
 
Some of the things that can be accomplished in POSIX shell are wild. I am looking forward to picking up some new tips from dteske's upcoming book on this topic. Having said that, I must admit some bashisms (or zshisms) would make some things safer and easier. One example is local. Maybe it's not the best example, because it's actually supported in FreeBSD's /bin/sh, but it is not part of POSIX.
Thank for the tip on incoming book. Call me old fashioned but for serious shell programming I really like ksh93 language.
 
I haven't used it seriously but dtksh (I think based on ksh93) is seemingly powerful. It has bindings against Motif and CDE so that you can create GUI forms from within your shell scripts. It almost feels a bit like how you can open .NET winforms in Microsoft's powershell.
 
I haven't used it seriously but dtksh (I think based on ksh93) is seemingly powerful. It has bindings against Motif and CDE so that you can create GUI forms from within your shell scripts. It almost feels a bit like how you can open .NET winforms in Microsoft's powershell.

above... remnids me :

Bill Gates Said:

I Will Always Choose A Lazy Person
To Do A Difficult Job ...
Because, He Will Find An Easy
Way To Do It.

Might be a good principle. Maybe, or most likely, the simplest code, the better. Maybe it could be applied as well for BASH ;)
 
Because of license issue. I've tried and so far bash is superior to any of *csh, *ksh.
 
For systems programming, stick to `sh`. You'll find `sh` is installed everywhere.
For everything else, it's whatever you prefer. Installing `bash` via `pkg` is 1 command and is hardly "jumping through hoops".

(offtopic)
When I see `/bin/bash` at the top of scripts I cringe slightly at the incompetence of the developer of said script. ;)
 
Yes I always put #! /bin/sh at the top of my scripts, though I only write them for my own use. Otherwise I do run bash as my login shell. You can actually replace sh with bash and bash will run in sh emulation mode when it sees the /bin/sh shebang. Though I'd rather use sh with FreeBSD since sh is the default system shell. It really doesn't give me any trouble, but there some features in bash not available with sh.
 
Yes I always put #! /bin/sh at the top of my scripts, though I only write them for my own use. Otherwise I do run bash as my login shell. You can actually replace sh with bash and bash will run in sh emulation mode when it sees the /bin/sh shebang. Though I'd rather use sh with FreeBSD since sh is the default system shell. It really doesn't give me any trouble, but there some features in bash not available with sh.

actually, there is not necessarily the need of a shell. System() and C is there for making anything wished.
 
actually, there is not necessarily the need of a shell. System() and C is there for making anything wished.
Of course you can replace a script with C, but remember that system(3) spawns a new /bin/sh every time you call it. If your C program calls system() often you might as well just use a shell script.
 
Newer doesn't automatically imply better. Quite frankly I can't really think of much things which I would be able to do in bash and not in sh.

Although I favor sh over bash I personally prefer working with ksh (shell/pdksh) on my servers.

I know this is a late reply, but fwiw: I have often thought that: if anything beyond sh is required, it might make more sense to go with perl or python. There are so many different incompatible shells.

But bash seems to be the choice of Linux, and Mac. I would think those two systems are more prevalent than BSD or proprietary UNIXs.
 
Also, a note of overly configurable things: people tend to massively personalise them.

I’ve worked on lots of boxen which I’m not allowed to configure (many customer sites where I don’t get a personal user account).
Having an overly configured shell or editor would have (and has in some cases) slowed me down and would me up on machines where my configurations don’t exist, and therefore my muscle-memory is useless.

IMO: something that is often overlooked is what happens when other people have to work with your system, code, apps, etc. and vice-versa.

You may be able to understand your spaghetti perl code, but will anybody else?
 
Yes I always put #! /bin/sh at the top of my scripts, though I only write them for my own use.

In my experience, that will not work with a Mac. Macs will run everything in bash, and an older version of bash at that. Although, I think that may be changing.
 
Very strange question for me.
Why wget is not installed by default ?
Why Microsoft Outlook is not installed by default ?
Why gnome is not installed by default ?

When I was a young boy, my mom learn to le that we have to ask «how could/can I install bash?»

No ?

Why do you want to impose your bash on my system ?
 
To clarify with Mac--back when they first began OSX, with names like Jaguar and such, the default shell was tsch. I think at the time (though I could easily be wrong here) they took a lot more from FreeBSD as it (OSX) was very new.
Later it changed to bash, I'm not sure when. Personally, I wish they had stuck with cat names, then we might get names like Mac Black Domestic Shorthair or Mac Scottish Fold which would have been cool names IMHO. Then, and again I don't know when, it changed over to zsh as its default shell. Mac users who care are probably easily able to change their shells but the majority of Mac users probably stick to the GUI tools and don't even notice.
 
Very strange question for me.
Why wget is not installed by default ?
Why Microsoft Outlook is not installed by default ?
Why gnome is not installed by default ?

When I was a young boy, my mom learn to le that we have to ask «how could/can I install bash?»

No ?

Why do you want to impose your bash on my system ?

As I explained: bash was more standard, and more powerful.

Bash is the standard on Linux. I think it's fair to say that Linux is the most widely used UNIX like OS. Although, arguably, Linux is not very UNIX like after systemd.

At the time of my original post, bash was also the standard on MacOS.

I figured it would be easier to move bash scripts, and bash skills, between OSes, if a more standard shell was used.
 
Status
Not open for further replies.
Back
Top