On 2009-Aug-13 18:15:58 +1000, Minh Nguyen <[email protected]> wrote:
>comments and emails, I've learnt many valuable tips. One in particular
>is to avoid Bashism in shell scripts so as to make one's shell scripts
>more portable to other platforms. This has made me more aware of
>non-portable features I use my shell scripts, prompted me to read up
>on ways to write portable scripts, and helped me to learn about
>virtues of portability. A big thank you to you. If we ever meet in

Solaris /bin/sh is definitely the lowest common denominator - it does
not even support full POSIX functionality.  The main issue I've noticed
whilst porting Sage to FreeBSD is the use of "source" instead of "." to
include sub-scripts.  Actually tracking them all down is time-consuming.
(And, BTW, putting a #! line in subscripts has no effect because those
scripts always run within the shell that sourced them).

IMHO, ideally, scripts (including all sub-scripts sourced) shouldn't
use bash extensions, where this isn't possible, it should begin
#!/usr/bin/env bash

The other issue is that 'make' will default to spawning processes using
$SHELL - so either lines in makefiles need to avoid bash'isms ('source'
is used in at least one makefile) or SHELL needs to be set to bash
at the start of the build process.

-- 
Peter Jeremy

Attachment: pgpxEFsUx2jZ3.pgp
Description: PGP signature

Reply via email to