/bin/sh - POSIX?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

/bin/sh - POSIX?

René J.V. Bertin
Hi,

Can someone please confirm whether /bin/sh is still POSIX compliant on 10.12.latest (i.e. `/bin/sh --version` shows it's actually bash), please?

thanks,
René
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

j. van den hoff-3
On Tue, 07 Mar 2017 15:12:07 +0100, René J.V. Bertin <[hidden email]>  
wrote:

> Hi,
>
> Can someone please confirm whether /bin/sh is still POSIX compliant on  
> 10.12.latest (i.e. `/bin/sh --version` shows it's actually bash), please?
>
> thanks,
> René

 from `man bash':

"If bash is invoked with the name sh, it tries to mimic the startup  
behavior of historical versions of sh
        as  closely as possible, while conforming to the POSIX standard as  
well."


whatever "tries" means exactly ... ;-). there is another hint somewhere  
else at "brace expansion" handling. my reading of that is that you would  
have to call `sh +B' or do `set +B' within your script to get _strict_  
`sh' compliance. -- but better read the manpage yourself ;-)

HTH
joerg


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

Yongwei Wu
In reply to this post by René J.V. Bertin
From the man page:

Bash is largely compatible with `sh' and incorporates useful
features from the Korn shell `ksh' and the C shell `csh'.  It is
intended to be a conformant implementation of the IEEE POSIX Shell and
Tools portion of the IEEE POSIX specification (IEEE Standard 1003.1).
It offers functional improvements over `sh' for both interactive and
programming use.

and

Starting Bash with the `--posix' command-line option or executing `set
-o posix' while Bash is running will cause Bash to conform more closely
to the POSIX standard by changing the behavior to match that specified
by POSIX in areas where the Bash default differs.

When invoked as `sh', Bash enters POSIX mode after reading the
startup files.

On 7 March 2017 at 22:12, René J.V. Bertin <[hidden email]> wrote:
> Hi,
>
> Can someone please confirm whether /bin/sh is still POSIX compliant on 10.12.latest (i.e. `/bin/sh --version` shows it's actually bash), please?
>
> thanks,
> René



--
Yongwei Wu
URL: http://wyw.dcweb.cn/
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

René J.V. Bertin
Thanks. This doesn't really answer the question if /bin/sh is still bash but I suppose there is little chance that has changed since 10.9 .

R.
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

Julien Salort
René J.V. Bertin <[hidden email]> wrote:

> Thanks. This doesn't really answer the question if /bin/sh is still bash
> but I suppose there is little chance that has changed since 10.9 .

I am running Sierra 10.12.3.

% /bin/sh --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Copyright (C) 2007 Free Software Foundation, Inc.

HTH,

--
http://www.juliensalort.org

Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

j. van den hoff-3
In reply to this post by René J.V. Bertin
On Tue, 07 Mar 2017 15:41:42 +0100, René J.V. Bertin <[hidden email]>  
wrote:

> Thanks. This doesn't really answer the question if /bin/sh is still bash  
> but I suppose there is little chance that has changed since 10.9 .

right. and I would have thought _that_ part of your original mail (the  
main part seemingly was concerned with POSIX compliance, no?) you had  
already answered yourself via issuing `/bin/sh --version'?


>
> R.


--
Using Opera's revolutionary email client: http://www.opera.com/mail/
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

René J.V. Bertin
On Tuesday March 07 2017 16:32:37 j. van den hoff wrote:

> right. and I would have thought _that_ part of your original mail (the  
> main part seemingly was concerned with POSIX compliance, no?) you had  
> already answered yourself via issuing `/bin/sh --version'?

Indeed, but on 10.9 . I needed to be certain that there had been no changes no matter how unlikely that seemed (or not, given Apple's allergy towards GPL'ed software).

R.
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

Brandon Allbery

On Tue, Mar 7, 2017 at 11:38 AM, René J.V. Bertin <[hidden email]> wrote:
Indeed, but on 10.9 . I needed to be certain that there had been no changes no matter how unlikely that seemed (or not, given Apple's allergy towards GPL'ed software).

Not GPL in general, just GPL3. Which is why they ship the last GPL2 bash. I would not expect them to replace this unless someone comes up with a feature complete bash clone (at least up to the last GPL2 version) with an acceptable license; too many of Apple's own scripts would break.

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
Reply | Threaded
Open this post in threaded view
|

Re: /bin/sh - POSIX?

Yongwei Wu
In reply to this post by René J.V. Bertin
I think people paid more attention to the first part of your question
(whether /bin/sh is POSIX compliant) than the second part in
parentheses (whether it is bash—I completely misunderstood that part).

On 7 March 2017 at 22:41, René J.V. Bertin <[hidden email]> wrote:
> Thanks. This doesn't really answer the question if /bin/sh is still bash but I suppose there is little chance that has changed since 10.9 .
>
> R.



--
Yongwei Wu
URL: http://wyw.dcweb.cn/