[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] <bug> shell scripts fail when /bin/sh <> /bin/bash

From: Jerzy Luszawski
Subject: Re: [Gnumed-devel] <bug> shell scripts fail when /bin/sh <> /bin/bash
Date: Fri, 1 Aug 2008 23:25:26 +0200
User-agent: KMail/1.9.9

Friday 01 August 2008 12:48:55 Karsten Hilbert napisaƂ(a):

> > I tried to install gnumed on the fresh installation of Kubuntu 8.04 and
> > was caught by various syntax errors when executing scripts. It turned out
> > that in Kubuntu /bin/sh is linked to /bin/dash instead of /bin/bash as in
> > many other common distros.

> > It is easy to avoid  by putting explicit reference to bash in the scripts
> > (#!/bin/bash). This could save some great deal of frustration for
> > potential users.
> Fixed in our shell scripts. I'd be happy to apply specific
> patches you might come up with to remove bashisms from our
> scripts.

I'm not sure if it is possible and desirable to avoid bash-specific code. You 
probably  cannot write a script that will work in *every* shell.

The problem I ran into was:
1. string comparison in bash is '==' while in dash is single '='
According to bash man you can use single '=' as well.
2. function definition in bash is 'function <name> () <command>' while in dash 
is '<name> () <command>'
Man says that the word 'function' is optional.

I think that changing shebang to /bin/bash is clear and simple solution. If 
only I knew that bash is required, I wouldn't complain at all. 
(To be quite truthful I wasn't aware that I have dash as default shell until 
this problem appeared)

Jerzy Luszawski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]