Running SAS on Ubuntu Linux: Dash to Bash

It happened to me again today … the Ubuntu dash-bash-default-shell-thing:

userid@hostname:~$ /opt/sas92/SASFoundation/9.2/sas
/bin/sh: 0: Illegal option -p
userid@hostname:~$ /opt/sas93/SASFoundation/9.3/sas
/bin/sh: 0: Illegal option -p

I encounter this every now and then. This time I was upgrading my notebook and it’s Ubuntu 64-bit installation to 12.10 and restoring SAS 9.2 & 9.3 installations from backup.

Several years ago the default shell symlink of /bin/sh to /bin/bash was changed to /bin/dash in Ubuntu. You can find out more about the reasoning behind Ubuntu’s switch from bash to dash here – it caused quite a bit of discussion when it happened.

The often suggested fix is to manually change the /bin/sh symlink, but there’s also a command to do it (which also fixes the associated man page symlink too):

userid@hostname:~$ sudo dpkg-reconfigure dash
  Configuring dash
  The system shell is the default command interpreter for shell scripts.
  Using dash as the system shell will improve the system's overall performance.
  It does not alter the shell presented to interactive users.
  Use dash as the default system shell (/bin/sh)?
  <Yes> <No>

Select No, to choose bash over dash, and you should see the following output:

Removing 'diversion of /bin/sh to /bin/sh.distrib by dash'
Adding 'diversion of /bin/sh to /bin/sh.distrib by bash'
Removing 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
Adding 'diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by bash'

These are the symlinks it fixes:

userid@hostname:~$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Oct 19 16:23 /bin/sh -> bash
userid@hostname:~$ ls -l /usr/share/man/man1/sh.1.gz
lrwxrwxrwx 1 root root 9 Oct 19 16:23 /usr/share/man/man1/sh.1.gz -> bash.1.gz

Some other sources of information about bash and dash and other steps that might be needed to get SAS software running on Ubuntu can be found at these locations:

2 thoughts on “Running SAS on Ubuntu Linux: Dash to Bash”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.