groff
[Top][All Lists]
Advanced

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

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


From: Peter Schaffter
Subject: Re: [Groff] [PATCH] Use bash for several contrib scripts
Date: Fri, 3 Jan 2014 10:50:24 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Fri, Jan 03, 2014, Roger Leigh wrote:
> > #!/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
> 
> #!/bin/bash
> 
> 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.

"Break" unecessarily, in many cases.  Question of looking at which
strategy fails least often in the real world.  Specifying the shell
explicitly always fails if the shell isn't present; specifying
/bin/sh only fails in cases where features of a particular shell are
incompatible with the shell /bin/sh points to.

My suggestion wasn't entirely serious, though. :)  I agree with both
statements:

> If you use "#!/bin/sh" you do need to restrict yourself to POSIX
> sh features.

  and

> But if you want more features of a particular shell, then you just
> need to use that shell explicitly.

-- 
Peter Schaffter
http://www.schaffter.ca



reply via email to

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