[Top][All Lists]

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

Re: [Groff] [PATCH] Use bash for several contrib scripts

From: Roger Leigh
Subject: Re: [Groff] [PATCH] Use bash for several contrib scripts
Date: Fri, 3 Jan 2014 13:21:38 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 02, 2014 at 09:12:38PM -0500, Peter Schaffter wrote:
> On Thu, Jan 02, 2014, Mike Bianchi wrote:
> > How is someone attempting to understand a  #!/bin/sh  script to know what 
> > the
> > writer intended if there is no documented way to interpret the syntax?
> #!/bin/sh
> # This script is written for the bash shell.  See bash(1).
> Or is that just too obvious?

It's incorrect.  If you're writing a script for the bash shell, then
all you need to do is use


and then you'll be sure you're running the script under the correct
shell.  Given that /bin/sh isn't guaranteed to be bash (and on many
systems, is indeed not bash), it will break on these systems.  If you
use "#!/bin/sh" you do need to restrict yourself to POSIX sh features.
But if you want more features of a particular shell, then you just
need to use that shell explicitly.


  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux   
 `. `'   Printing on GNU/Linux?
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: signature.asc
Description: Digital signature

reply via email to

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