which is the basic differences between the shells?

Giorgos Keramidas keramida at ceid.upatras.gr
Sun Jun 6 11:19:32 UTC 2010

On Sat, 5 Jun 2010 22:35:09 +0000, Giorgos Tsiapaliokas <terietor at gmail.com> wrote:
> hello,
> i am coming from the linux world where i was using the bash shell but
> i found out that there are also much more.
> can u tell me the basic differences between them?(pros and cons)

It isn't humanly possible to write *all* the differences of *all* the
shells in a single email reply.  But you can find a good table that
compares various shells in Wikipedia:


In a FreeBSD context there are also a few more things to consider when
comparing shells:

  * Is the shell part of the base system or a port/package?

  * Is the shell well maintained?

  * Does the shell depend on many other ports or none at all?

  * Does the shell support building static-only copies?  This is useful
    if you want to upgrade the base system without breaking the login
    shell you are using every day.

Having said that, here are a few personal notes from my own experience
with shells on FreeBSD...

The /bin/sh and /bin/csh shells are part of the base system, so they are
rebuilt as part of the normal buildworld process.  The big advantage of
using a shell that is part of the base system is that it's always
there.  Any shell scripts or code you write that uses these shells will
have a great chance of running on ANY FreeBSD system out there.  That's
where traditionalism stops and personal preference jumps in though...

I don't like using csh(1) for a lot of things.  It syntax makes me
cringe, even though it's a mostly "ok" interactive shell.  So I always
install at least bash and mksh on my systems.

There is no bash shell in the *base* system of FreeBSD.  But there are
many ports for command shells, and bash is part of these:

    # cd /usr/ports/shells
    44bsd-csh       dash            jailkit         pdksh           tcshrc
    Makefile        es              ksh93           pear-PHP_Shell  v7sh
    bash            esh             lshell          psh             viewglob
    bash-completion fd              mksh            rc              vshnu
    bash-static     fish            nologinmsg      rssh            wapsh
    bash3           flash           osh             sash            zoidberg
    bash3-static    gscommander     p5-Shell-Perl   scponly         zsh
    bashc           heirloom-sh     p5-Term-ShellUI shell-include
    ch              ibsh            pash            tcsh_nls

You can always install bash with "pkg_add".  The default package is not
built as a static binary, but you can compile a static bash binary from
its port:

    # cd /usr/ports/shells/bash
    # make WITH_STATIC_BASH=1 install clean

The bash shell depends on two other ports: gettext and libiconv.  These
are not large ports, but it is often a good idea to have a shell around
that only depends on libc.

This is why I also install 'shells/mksh' on my systems.  It's the ksh
compatible shell of the MirOS BSD folks.  It has a small foot-print, a
ksh-compatible syntax, and it depends only on libc.so:

    keramida at kobe:/home/keramida$ ldd `which mksh`
            libc.so.7 => /lib/libc.so.7 (0x280c9000)

More information about the freebsd-questions mailing list