T’info about Dash

Once upon a time there was the Bourne command shell. sh as it is known is core at the heart of any UNIXy type operating system and others too. However for some it didn’t do enough so the Bourne Again shell, bash, was written and nearly every system ships with that. These shells are not the same. The have similar syntax but do not behave similarly.

There are other shells which have a completely different syntax and other scripting languages such as Perl and PHP so when writing a shell script you can indicate the correct interpreter using the ‘hash bang bin bash’ comment to indicate you are using bash. I.e.

#!/bin/bash

Some lazy programmers don’t indicate the exact shell they require and use

#!/bin/sh

to mean bash when it means sh.

Ubuntu, in their wisdom, have decided to go for dash as their shell. It is an evolution of the Almquist shell and is smaller and lighter weight than bash however they install bash anyway. dash and bash have the common subset of sh commands but are different. So if you find you have a problem building or similar on Ubuntu it may be that the wrong shell is being used. Ubuntu has a symlink as follows:

lrwxrwxrwx 1 root root       4 Mar 29  2009 sh -> dash

You may need to change this to point to dash as follows:

$ cd /bin
$ sudo rm sh
$ sudo ln -s bash sh

While we’re handling Ubuntu oddities building against NCurses, the terminal output library, can also be problematical. A little while ago NCurses was split in to two libraries, libncurses.so and libtinfo.so. Some badly written software will try and link explicitly with libtinfo.so directly rather than trying libncurses.so first. Ubuntu does not split these two libraries but provides just the one libncurses.so library so if you have an issue with a missing libtinfo.so you will need to add symlinks in to your library directory as follows:

$ cd /usr/lib
$ ln -s libncurses.so.5 libtinfo.so.5
$ ln -s libtinfo.so.5 libtinfo.so

Tags: , , , , ,

2 Responses to “T’info about Dash”

  1. Alice Chapman Says:

    The lack of libtinfo.so is not so much a specific Ubuntu oddity, some other distributions don’t provide it either. The default behaviour when building NCurses is not to produce a separate libtinfo.so. It is only done when adding the –with-termlib switch to the NCurses configure script when building NCurses.

    I do agree that linking libtinfo.so explicitly is broken behaviour, as it will not exist with a default shared library build of NCurses.

    The same issue can arise with libtic.so, which can also be built as a separate library from libncurses.so by use of the –with-ticlib switch.

  2. C code with ncurses compiled with libtinfo dependency | BlogoSfera Says:

    […] of here (and other sources), http://www.cyberspice.org.uk/blog/2009/12/24/tinfo-about-dash/ , it seems that it’s an issue that can be solved by writing the code in a different way or […]

Leave a Reply