#!/bin/bash

Julian Field mailscanner at ecs.soton.ac.uk
Wed Jan 11 04:10:51 GMT 2006


On 11 Jan 2006, at 00:13, Matt Kettler wrote:

> Nerijus Baliunas wrote:
>> On Tue, 10 Jan 2006 23:33:41 +0000 Drew Marshall  
>> <drew at THEMARSHALLS.CO.UK> wrote:
>>
>>
>>>> have #!/bin/bash at the first line, and I have to change it to
>>>> #!/usr/local/bin/bash on my FreeBSD system. If they are not using
>>>> any bash'isms it would be better to change all #!/bin/bash to #!/
>>>> bin/sh.
>>>
>>> Did you install from the ports tree? This is all fixed in there
>>> automagically.
>>
>>
>> No, but I want it to be fixed in distribution (and then it will be  
>> one less
>> patch in ports :).
>>
>
> I would tend to agree.. if you're not really using any bash  
> features, you should
> be using /bin/sh for the scripts. It makes things so much more  
> portable.
>
> Fixing it in the ports tree solves the symptoms, but there's a more  
> general
> problem here of "upping the bar higher than is required".
>
> I make these three points:
>
> 1) Pretty much everybody has a /bin/sh. This is a POSIX standard,  
> and nearly
> every *nix out there conforms to this part of the standard. Sure  
> there are a few
> exceptions, but these are very rare.
>
> 2) There is no standard that specifies bash configuration that's  
> common to
> different major *nix flavors (Linux, *BSD, Solaris, etc). For  
> example LSB might
> specify bash, but that only applies to Linux variants.
>
> 3) Everybody who has bash has sh, since bash supports being invoked  
> as sh.
> However, not everybody who has sh has bash. (Yes, there are folks  
> out there who
> consider bash an optional add-on, not a core OS feature, hence it  
> appearing in
> /usr/bin.)

I entirely agree with you. I will have to go through the scripts that  
have this and try to check that they don't have any bash-isms that I  
know of. The only one that springs to mind is
	export VARIABLE=value
which I will need to change to
	VARIABLE=value
	export VARIABLE

What else should I be looking for? I tend to write for whatever  
version of sh happens to be on the system I'm writing on at the time.  
Bad practice, I know :-(


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the Wiki (http://wiki.mailscanner.info/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).

Support MailScanner development - buy the book off the website!



More information about the MailScanner mailing list