# Why not use bash by default?



## walterbyrd (Feb 2, 2018)

I know you can use bash with the FreeBSD, but you have to jump through some hoops.

It seems to me that bash is more powerful, and much more widely used. Yet the BSDs seem to be opposed to it.


----------



## ljboiler (Feb 2, 2018)

I think it's not included with the base system mainly because of the license.


----------



## tobik@ (Feb 2, 2018)

bash's license (GPLv3) is incompatible with *BSD project goals.

https://wiki.freebsd.org/GPLinBase
https://www.freebsd.org/doc/en_US.ISO8859-1/books/faq/introduction.html#idp55032936
https://www.openbsd.org/policy.html


----------



## ekingston (Feb 2, 2018)

FreeBSD seams to try to align with the POSIX standards. Bash is not POSIX compliant, but sh is (mostly). I'm not sure if this is the official reasoning, but it is my observation. Same reason FreeBSD defaults to POSIX awk and grep instead of gawk and gnu-grep.

And, as others have said, licensing.


----------



## SirDice (Feb 2, 2018)

walterbyrd said:


> It seems to me that bash is more powerful, and much more widely used.


Only if you come from a Linux background. On Solaris, AIX, HP-UX ksh is more common. On the *BSDs csh is more common. On Windows CMD.EXE and PowerShell are more common.

Use whichever shell you are most comfortable with, there's plenty to choose from. It's just that the base OS only supplies (t)csh and sh.


----------



## CraigHB (Feb 2, 2018)

Bash for me, just what I'm used to.  It's not a problem at all to install.  Just a pkg job and a little manual configuration.   I don't find csh too hard to deal with.  There's a few things that differ, but I can use it if I have to.  Bash does have a bigger number of options and functions though.  It's the system shell (sh) I find hard to deal with, it lacks a lot of stuff.


----------



## Datapanic (Feb 2, 2018)

Interesting enough, on my old Sunblade 100 running SunOS 5.8 Generic_117350-29 sun4u sparc SUNW has bash is installed by default OS install options:
-r-xr-xr-x   1 root     bin       516392 Jan  5  2000 /bin/bash


----------



## rotor (Feb 2, 2018)

walterbyrd said:


> I know you can use bash with the FreeBSD, but you have to jump through some hoops....



I don't use the sh shell when I use FreeBSD (I tend towards tcsh nowadays).  If there are any hoops that need jumping through in order to install a different shell, then I wouldn't call them much of a barrier at all.  I just install the package and copy over the profile I use for the shell.  It takes a couple of minutes, tops.


----------



## forquare (Feb 3, 2018)

Datapanic said:


> Interesting enough, on my old Sunblade 100 running SunOS 5.8 Generic_117350-29 sun4u sparc SUNW has bash is installed by default OS install options:
> -r-xr-xr-x   1 root     bin       516392 Jan  5  2000 /bin/bash



I think newer version of bash shells/bash have an updated license which makes commercial vendors twitchy - hence why macOS has an old version.

Personally, I use shells/zsh.  It's a similar evolution of sh(1), and has a similar feature set, but has a more permissive license.


----------



## ShelLuser (Feb 3, 2018)

walterbyrd said:


> It seems to me that bash is more powerful


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.


----------



## Deleted member 30996 (Feb 4, 2018)

sh is all I've ever used on FreeBSD. I have a shell scripting tutorial for it I've read, but I like doing everything by hand.


----------



## sidetone (Feb 4, 2018)

Why is that a question here?


----------



## tobik@ (Feb 4, 2018)

sidetone said:


> Why is that a question here?


Why wouldn't it be?


----------



## sidetone (Feb 4, 2018)

sidetone said:


> Why is that a question here?





tobik@ said:


> Why wouldn't it be?


Because Bash is a Linuxism, and anyone (truly) familiar with FreeBSD wouldn't ask that question.

It is baffling, why someone with that many posts asks that question. Most literature on FreeBSD (not Unix related variants overall) would have to be skipped for a question like that. It shouldn't have to be explained, because anyone familiar with FreeBSD, should know this, based on almost everything there is to read about FreeBSD anywhere, but especially everywhere on freebsd.org.

That's like operating a forklift, then asking in seriousness, "what's a forklift?"


----------



## Datapanic (Feb 4, 2018)

sidetone said:


> Because Bash is a Linuxism, and anyone (truly) familiar with FreeBSD wouldn't ask that question.
> 
> It is baffling, why someone with that many posts asks that question. Most literature on FreeBSD (not Unix related variants overall) would have to be skipped for a question like that. It shouldn't have to be explained, because anyone familiar with FreeBSD, should know this, based on almost everything there is to read about FreeBSD anywhere, but especially everywhere on freebsd.org.
> 
> That's like operating a forklift, then asking in seriousness, "what's a forklift?"



Citation Please!

Look on Wikipedia - https://en.wikipedia.org/wiki/Bash_(Unix_shell) 

"Brian Fox began coding Bash on January 10, 1988[20] after Richard Stallman became dissatisfied with the lack of progress being made by a prior developer.[7] Stallman and the Free Software Foundation (FSF) considered a free shell that could run existing shell scripts so strategic to a completely free system built from BSD and GNU code that this was one of the few projects they funded themselves,"


----------



## sidetone (Feb 4, 2018)

Datapanic said:


> Citation Please!


here:
freebsd.org


> "Brian Fox began coding Bash on January 10, 1988[20] after Richard Stallman became dissatisfied with the lack of progress being made by a prior developer.[7] Stallman and the Free Software Foundation (FSF) considered a free shell that could run existing shell scripts so strategic to a completely free system built from BSD and GNU code that this was one of the few projects they funded themselves,"



Irrelevant. Bash uses a GPL license, so anyone who knows anything about FreeBSD knows that it is incompatible with its base. So again, these questions are silly, and don't belong here.

So, again this is like a forklift operator asking, "what's a forklift." Does the forklift driver need a citation? Is someone going to ask, what is the definition of "is" and that you need a citation for that? GIVE ME A BREAK.

What do you want a citation for, on the definition of a forklift? or the definition of FreeBSD?


----------



## Datapanic (Feb 4, 2018)

Well.  Bash may be a "Linuxism" now, but Linux is not where Bash originated from.


----------



## sidetone (Feb 4, 2018)

Tell the developers to put (GPL licensed) Bash into FreeBSD's base as default, in all seriousness, if you think this is a real question. And they'll wonder if you've read anything at all on freebsd.org

You can't be serious, asking this. I suspect laziness more than trolling, to even ask this.


----------



## Spartrekus (Feb 4, 2018)

Simple:
*Because FreeBSD is NOT Linux !*

*BSD tries to keep clean.
Next to Windows, Bash is the most unreliable thing ever.


----------



## Nicola Mingotti (Feb 4, 2018)

I am new to the FreeBSD world, and I am more interested in stability, order and documentation than licensing. That is the reason why I switched from Linux. 

I was also asking myself why bash is not default in FreeBSD and OpenBSD but, since it is so easy to change shell, I found it to be a non-issue.

I am gratefull to walterbyrd to pose the question and to sidetone for his secure answer.

Maybe this information should be put into the FreeBSD Handbook since I think a lot of migrants from the Linux world ask themselves this question. Otherwise, sooner or later someone else will ask again

In particular, a good position to write something I think would be here:
https://www.freebsd.org/doc/handbook/shells.html
Where I think *many newcomers land and could be made aware of the licensing issue*
even if they did not arrive to FreeBSD for licensing reasons.


Bye
Nicola


----------



## sidetone (Feb 4, 2018)

Nicola Mingotti said:


> I am new to the FreeBSD world, and I am more interested in stability, order and documentation than licensing. That is the reason why I switched from Linux.
> 
> I was also asking myself why bash is not default in FreeBSD and OpenBSD but, since it is so easy to change shell, I found it to be a non-issue.
> 
> ...


You're a new user, so it is ok if you recently wondered why. I get baffled when those who've been here for some time ask it.

Everyone knows Bash has more features and so forth, but that's not relevant about why something goes into FreeBSD's base as default.


----------



## scottro (Feb 4, 2018)

https://www.freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/shells.html already  gives an explanation, though it doesn't mention the licensing.   OpenBSD uses a ksh variant, don't know what the others use, but I suspect that, along with licensing, it has to do with developer preferences.  It's so easy to add an additonal shell that I don't think the, "Why" part comes up very often.  I think TrueOS may have bash as default, as does MacOS.

Anyway, I think there's something in the rules about personal attacks, so let's try to not get the thread closed.


----------



## Nicola Mingotti (Feb 4, 2018)

scottro said:


> https://www.freebsd.org/doc/en_US.ISO8859-1/articles/linux-users/shells.html already  gives an explanation, though it doesn't mention the licensing.



Exactly, I red that page some days ago, the licensing reason should written somwehere there.

What makes a Linux user (unaware of licensing) wander why "tcsh" is that, for example, all scripts in FreeBSD /etc/rc.d at written for "/bin/sh", so it would be "natural" to use "bash" as default shell since it is an "sh" superset. Instead "tcsh" is a "csh" superset. (I am quoting man pages, I have very little expericence with non-bash non-sh shells )


----------



## scottro (Feb 4, 2018)

Yes, tcsh is in the csh family.   The sh shell is a Bourne style shell, (Bash stands for Bourne again shell), as is the OpenBSD default ksh. 
When Apple first introduced OSX, the first one, (I think it was called Cheetah--they should have stuck with cat names, so we could have releases like American Domestic Shorthair, but I digress), used tcsh.  After two or three releases, they changed their default to bash.


----------



## robroy (Feb 4, 2018)

scottro said:


> they should have stuck with cat names, so we could have releases like American Domestic Shorthair



Great one hahaha!


----------



## Spartrekus (Feb 4, 2018)

Bash has many bugs, it is overloaded, Bash would menace the stability of FreeBSD, prob. of license, ... and so and so on,  and not necessary at all.

FreeBSD has already many too much things by default !!

It would be like as worst as having a SystemD


----------



## linux->bsd (Feb 4, 2018)

Bash() is superior to sh() in most respects, but people don't realize it because they don't know what it's capable of. Just like the people that think vi() is anywhere equal to vim(), probably because they don't know about Vimscript.

Here are some of the commands for manipulating the history that are exclusive to Bash():

```
Commands for Manipulating the History
     beginning-of-history (M-<)
              Move to the first line in the history.
       end-of-history (M->)
              Move  to  the end of the input history, i.e., the line currently
              being entered.
       reverse-search-history (C-r)
              Search backward starting at the current  line  and  moving  `up'
              through  the  history  as  necessary.   This  is  an incremental
              search.
       forward-search-history (C-s)
              Search forward starting at the current line  and  moving  `down'
              through  the  history  as  necessary.   This  is  an incremental
              search.
       non-incremental-reverse-search-history (M-p)
              Search backward through the history starting at the current line
              using  a  non-incremental  search  for  a string supplied by the
              user.
       non-incremental-forward-search-history (M-n)
              Search forward  through  the  history  using  a  non-incremental
              search for a string supplied by the user.
...
      yank-nth-arg (M-C-y)
              Insert  the  first argument to the previous command (usually the
              second word on the previous line) at point.  With an argument n,
              insert  the nth word from the previous command (the words in the
              previous command  begin  with  word  0).   A  negative  argument
              inserts the nth word from the end of the previous command.  Once
              the argument n is computed, the argument is extracted as if  the
              "!n" history expansion had been specified.
       yank-last-arg (M-., M-_)
              Insert  the last argument to the previous command (the last word
              of the previous history entry).  With a numeric argument, behave
              exactly  like  yank-nth-arg.   Successive calls to yank-last-arg
              move back through the history list, inserting the last word  (or
              the  word  specified  by the argument to the first call) of each
              line in turn.  Any numeric argument supplied to these successive
              calls  determines  the direction to move through the history.  A
              negative argument switches the  direction  through  the  history
              (back or forward).  The history expansion facilities are used to
              extract the last word, as if the "!$" history expansion had been
              specified.
       shell-expand-line (M-C-e)
              Expand the line as the shell does.  This performs alias and his-
              tory expansion as well as all of the shell word expansions.  See
              HISTORY  EXPANSION below for a description of history expansion.
       history-expand-line (M-^)
              Perform history expansion on  the  current  line.   See  HISTORY
              EXPANSION below for a description of history expansion.
...
      insert-last-argument (M-., M-_)
              A synonym for yank-last-arg.
       operate-and-get-next (C-o)
              Accept the current line for execution and fetch  the  next  line
              relative  to the current line from the history for editing.  Any
              argument is ignored.
       edit-and-execute-command (C-xC-e)
              Invoke an editor on the current command line,  and  execute  the
              result  as  shell  commands.   Bash  attempts to invoke $VISUAL,
              $EDITOR, and emacs as the editor, in that order.
...
```
I use those on a daily bases when administering *nix systems. Can you do the job without them? Of course. But you can also eat soup with a fork. I chuckle every time I see someone leaning on their left- or right-arrow keys on the command line when making edits.

My favorite though is its ability to do history expansion:

```
HISTORY EXPANSION
       The shell supports a history expansion feature that is similar  to  the
       history  expansion in csh.
...
  Event Designators
       An event designator is a reference to a command line entry in the  his-
       tory  list.   Unless  the reference is absolute, events are relative to
       the current position in the history list.

       !      Start a history substitution, except when followed by  a  blank,
              newline,  carriage return, = or ( (when the extglob shell option
              is enabled using the shopt builtin).
       !n     Refer to command line n.
       !-n    Refer to the current command minus n.
       !!     Refer to the previous command.  This is a synonym for `!-1'.
       !string
              Refer to the most recent command preceding the current  position
              in the history list starting with string.
       !?string[?]
              Refer  to the most recent command preceding the current position
              in the history list containing string.  The trailing  ?  may  be
              omitted if string is followed immediately by a newline.
       ^string1^string2^
              Quick  substitution.   Repeat  the  previous  command, replacing
              string1 with string2.  Equivalent  to  ``!!:s/string1/string2/''
              (see Modifiers below).
       !#     The entire command line typed so far.

   Word Designators
       Word  designators are used to select desired words from the event.  A :
       separates the event specification from the word designator.  It may  be
       omitted  if  the word designator begins with a ^, $, *, -, or %.  Words
       are numbered from the beginning of the line, with the first word  being
       denoted  by  0  (zero).  Words are inserted into the current line sepa-
       rated by single spaces.

       0 (zero)
              The zeroth word.  For the shell, this is the command word.
       n      The nth word.
       ^      The first argument.  That is, word 1.
       $      The last word.  This is usually  the  last  argument,  but  will
              expand to the zeroth word if there is only one word in the line.
       %      The word matched by the most recent `?string?' search.
       x-y    A range of words; `-y' abbreviates `0-y'.
       *      All of the words but the zeroth.  This is a synonym  for  `1-$'.
              It  is  not  an  error to use * if there is just one word in the
              event; the empty string is returned in that case.
       x*     Abbreviates x-$.
       x-     Abbreviates x-$ like x*, but omits the last word.
...
```
It's one of those things that if you don't know it exists, you don't miss it. But once you've used it, you get pissed off whenever you're stuck on a system that only has sh().


----------



## forquare (Feb 4, 2018)

linux->bsd said:


> Here are some of the commands for manipulating the history that are exclusive to Bash()



A number of these are available in shells/zsh, shells/ksh93, and tcsh(). So we have a number of ther shells which are more permissibly licensed. 

Some people care about this, others don’t.


----------



## Spartrekus (Feb 4, 2018)

linux->bsd said:


> Bash() is superior to sh() in most respects, but people don't realize it because they don't know what it's capable of. Just like the people that think vi() is anywhere equal to vim(), probably because they don't know about Vimscript.
> 
> Here are some of the commands for manipulating the history that are exclusive to Bash():
> 
> ...



It is probably much better to use vi, if you find it ok, than vim.
Elvis to vi, and so on.
If something works and is fine for you like this. nano is also fine and easy to compile and to port.

Sometimes, it's some overkill to have thousand features that we do not need, because it takes memory and resource.

Some users need them for a shell, so they can still try to compile bash from source or run pkg install bash, and make bash default.


----------



## Deleted member 9563 (Feb 4, 2018)

Just a sideways remark.  I'm probably not the only one here that thinks that "features" is not always a feature.


----------



## forquare (Feb 4, 2018)

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.


----------



## linux->bsd (Feb 4, 2018)

forquare said:


> A number of these are available in shells/zsh, shells/ksh93, and tcsh(). So we have a number of ther shells which are more permissibly licensed.
> 
> Some people care about this, others don’t.



Yeah, no doubt, the licensing issue isn't trivial and I'm not trying to minimize it. I'm just pointing out the feature-set differences between Bash() and sh() that I think make Bash() superior.

My issue with the other shells you listed is that some of their default settings are annoying to me and they feel too hand-holdy. Is it shells/ksh93 that sublists filenames instead of auto-completing words first? That really bugged me.


----------



## forquare (Feb 4, 2018)

linux->bsd said:


> My issue with the other shells you listed is that some of their default settings are annoying to me and they feel too hand-holdy.



Indeed, and now I’ve gotten used to tcsh() and configured my shells/zsh to be a bit more like it, I find shells/bash’s defaults to be kinda annoying. 
Horses for courses and all that


----------



## linux->bsd (Feb 4, 2018)

Spartrekus said:


> It is probably much better to use vi, if you find it ok, than vim.
> Elvis to vi, and so on.
> If something works and is fine for you like this. nano is also fine and easy to compile and to port.
> 
> ...



I like vi(), just not as much as vim(). Some things about it are just annoying: I don't like vi()'s rub-out settings at all, and it's one of the first settings changes I add to my .vimrc files.

The "overkill" concern is nonsensical to me though. Having access to better tools makes for better administration. Some people are scared of complexity or too many options though I'm sure. I know a guy that still doesn't even know how to use `dd` to delete a line in vi() or vim(). He simply goes to the end of the line, hits `a`, then deletes to the start of the line. He hates too many options, too.


----------



## linux->bsd (Feb 4, 2018)

forquare said:


> Indeed, and now I’ve gotten used to tcsh() and configured my shells/zsh to be a bit more like it, I find shells/bash’s defaults to be kinda annoying.
> Horses for courses and all that



You've been corrupted, haha. Bash() isn't perfect, but you don't lose any command line administration power by using it over the others you've listed. And when there's something niggling about the way it behaves, you can make .bashrc changes to it, thereby changing your course to match your horse.


----------



## linux->bsd (Feb 5, 2018)

forquare said:


> 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.



I've ran into similar situations, but that's easily addressable by running `bash --noprofile --norc` and `vim --norc`. Then, it's merely a matter of memorizing your favorite vim() settings and blasting them at the command line: `:set nu hls wmnu wim=longest,list`, etc. Takes less than 10 seconds, and allows you to be more efficient while still having access to the extensive list of vim() commands that vi() lacks.


----------



## CraigHB (Feb 5, 2018)

Spartrekus said:


> It would be like as worst as having a SystemD



Haha, language, language.


----------



## Deleted member 30996 (Feb 5, 2018)

CraigHB said:


> Haha, language, language.



Not everyone here speaks English as their mother tongue. Spartrekus is European.

There's nothing funny about it.


----------



## sidetone (Feb 5, 2018)

Trihexagonal said:


> Not everyone here speaks English as their mother tongue. Spartrekus is European.


I thought CraigHB was saying language about SystemD. Maybe I misunderstood.

The other quote was perfectly understandable, anyway.


----------



## linux->bsd (Feb 5, 2018)

Trihexagonal said:


> Not everyone here speaks English as their mother tongue. Spartrekus is European.
> 
> There's nothing funny about it.



Yeah, as sidetone said, I think he was making fun that SystemD is akin to profanity because of how sh*t it is.


----------



## Deleted member 48958 (Feb 5, 2018)

*1.* Because bash is GPL licensed and it is impossible to use it in FreeBSD base system.

*2.* Because other shells are also available preinstalled: sh for scripting and tcsh for interactive usage.

*3.* IMO zsh is much better applicant for default FreeBSD shell.
               *a.* Because it uses MIT-like license, that should be compatible with BSD license, and
               *b.* because it is much more usable than bash as an interactive shell, and even better then tcsh
               (for scripting we still are able to use regular bourne shell /bin/sh).
               *c.* Because zsh got bash emulation, just create zsh to bash symlink and use it to start bash scripts.


----------



## Datapanic (Feb 5, 2018)

To summarize, if you've been in IT professionally, in other words, to earn a living, you best embrace whatever it is whether you like it or not or just go private practice - of course you have a choice and can work it where ever you want, but for me - it's knowing Windows up to v10, Mac v(insert mountain), Linux (who cares!), Solaris (10/11), AIX (yes it's still around) and even BSD that keeps food on the plates for my family.  If I have to use sh or bash or ksh or tcsh or whatever, it doesn't matter.  The important thing is to know how to use it and if it's not there, in this case bash for FreeBSD, then just install the port and use it.  I don't see any sense in demeaning anyone who thinks their shell is better than some other shell.  Microsoft adding Bash to Windows 10 ought to be a sign of what's to come.  Look at the statistics.  Hate wont get you anywhere.


----------



## sidetone (Feb 5, 2018)

I don't hate anyone for using it. If you like it, use it. I have another shell preference, and I just install it.

It just perplexes me, because it's one of the first things I've learned about in FreeBSD (probably before I ever installed and used it), and I always come across why it's not in base. I don't think anyone is stupid for not knowing that; I don't understand how someone can go so long, without knowing it. It's like someone smart, who didn't do their homework/research for a long time. Newcomers, however, shouldn't be expected to know it. I'm going to leave it at that.

The issue should be, what's the easiest way to install the shell you like, as if it's in your own customized FreeBSD base, during/after your compile or `freebsd-update`.


----------



## azathoth (Feb 5, 2018)

walterbyrd said:


> I know you can use bash with the FreeBSD, but you have to jump through some hoops.
> 
> It seems to me that bash is more powerful, and much more widely used. Yet the BSDs seem to be opposed to it.


http://harmful.cat-v.org/software/
see line with bash!


----------



## sidetone (Feb 5, 2018)

azathoth said:


> http://harmful.cat-v.org/software/
> see line with bash!


I don't understand why a lot is on that list... svg, pdf, SQL, svn, XML (it carries more overhead than it should, and gets complex easy, but still structured), XMPP (probably bc it's XML based), it says no httpd is best, FreeBSD and NetBSD, Apache license and MPL.


----------



## azathoth (Feb 5, 2018)

sidetone said:


> I don't understand why a lot is on that list... svg, pdf, SQL, svn, XML (it carries more overhead than it should, and gets complex easy, but still structured), XMPP (probably bc it's XML based), it says no httpd is best, FreeBSD and NetBSD, Apache license and MPL.



The lower down section explains.
*Note*: At the moment a detailed rationale 
is not provided for most of this, so figuring out 
why some things are considered more or less
 harmful than others is left as an exercise for
 the reader. Here is a hint: _complexity_ is the
 bane of all software, _simplicity_ is the most
 important quality.


----------



## Deleted member 48958 (Feb 5, 2018)

azathoth said:


> http://harmful.cat-v.org/software/


Saw this list some time ago... Title of page "All software sucks" says it all.

My advice to the author — is not to use any computer at all, it will be most "harmless" for him.


----------



## azathoth (Feb 5, 2018)

ILUXA said:


> Saw this list some time ago...  Title of page "All software sucks" says it all.
> 
> My advice to the author — is not to use any computer at all, it will be most "harmless" for him.


Author is dead apparently: uriel
but my theory is he wanted to get away from it all and faked his death.


----------



## rotor (Feb 5, 2018)

Spartrekus said:


> ...Sometimes, it's some overkill to have thousand features that we do not need, because it takes memory and resource....



... and also increases the vulnerability attack surface.


----------



## Spartrekus (Feb 12, 2018)

rotor said:


> ... and also increases the vulnerability attack surface.



Most coders do not care about it.

besides, .... aren't you hearing this from Win developers?
Java is highly secured !!!
C#  is the power in the hands with a high-level of security.


----------



## DutchDaemon (Feb 13, 2018)

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.


----------



## azathoth (Feb 13, 2018)

DutchDaemon said:


> 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


----------



## jrm@ (Feb 13, 2018)

DutchDaemon said:


> 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.


----------



## Spartrekus (Feb 15, 2018)

DutchDaemon said:


> 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 .


----------



## Oko (Feb 15, 2018)

jrm@ said:


> 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.


----------



## kpedersen (Feb 15, 2018)

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.


----------



## Spartrekus (Feb 15, 2018)

kpedersen said:


> 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


----------



## giahung1997 (Feb 16, 2018)

Because of license issue. I've tried and so far bash is superior to any of *csh, *ksh.


----------



## pprocacci (Feb 17, 2018)

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.


----------



## CraigHB (Feb 17, 2018)

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.


----------



## Spartrekus (Feb 17, 2018)

CraigHB said:


> 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.


----------



## tobik@ (Feb 17, 2018)

Spartrekus said:


> 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.


----------



## walterbyrd (Nov 11, 2019)

ShelLuser said:


> 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.


----------



## walterbyrd (Nov 11, 2019)

forquare said:


> 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?


----------



## walterbyrd (Nov 11, 2019)

CraigHB said:


> 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.


----------



## Hakaba (Nov 11, 2019)

Mac OS X use tcsh. After that bash and now zsh...


----------



## walterbyrd (Nov 11, 2019)

Hakaba said:


> Mac OS X use tcsh. After that bash and now zsh...



I have an older Mac. I think it uses "Sierra." I think it still uses bash. But I have heard that newer versions of MacOS are going to use different shells.


----------



## Hakaba (Nov 11, 2019)

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 ?


----------



## scottro (Nov 11, 2019)

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.


----------



## walterbyrd (Nov 11, 2019)

Hakaba said:


> 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 ?
> ...



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.


----------



## rigoletto@ (Nov 11, 2019)

In short this is a completely useless discussion because for starters the bash license is GPL and then incompatible with BSD.


----------



## walterbyrd (Nov 11, 2019)

rigoletto@ said:


> In short this is an completely useless discussion because for starters the bash license is GPL and then incompatible with BSD.



I am happy to shut this discussion down. Can I do that?


----------



## SirDice (Nov 12, 2019)

walterbyrd said:


> Can I do that?


No, but we can. Thread's closed now.


----------

