bug-bash
[Top][All Lists]
Advanced

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

Re: last argument expansion has different output using the sh interprete


From: Jacoby Hickerson
Subject: Re: last argument expansion has different output using the sh interpreter
Date: Fri, 27 May 2011 17:01:19 -0700

On Fri, 2011-05-27 at 16:53 -0400, Greg Wooledge wrote:
> On Fri, May 27, 2011 at 01:35:50PM -0700, Jacoby Hickerson wrote:
> > Although, I am curious, is this is a matter of sh
> > being continually updated to exclude all bash extensions
> 
> Eh?  POSIX is defined by a group of people and published.  Here's the
> current edition:
> 
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/contents.html
> 
> "... continually updated to exclude bash extensions..." doesn't even make
> sense to me.  It doesn't generally get *smaller* with each edition;
> rather, it gets larger.
A simpler question that I could have asked would be "Why did it work
before?"  The now obvious answer is that it shouldn't have worked
before.  I just didn't know how sh evolves, now it is much more clear
thanks.
> > or perhaps
> > previously bash didn't interpret #!/bin/sh to be the POSIX compliant
> > interpreter?
> 
> Are you talking specifically about the behavior of bash when it is invoked
> as "sh"?  If I were you, I wouldn't even waste brain cycles on that.
> When you write a script, decide whether you are writing a bash script,
> or an sh script.  If you are writing a bash script, pick which version of
> bash you are writing it for, and then use the features available in that
> version and older, and use the #!/usr/bin/env bash or #!/bin/bash shebang.
> If you are writing for sh, then use only POSIX features, and use the
> #!/bin/sh shebang.
It was being executed from within a bash shell but using #!/bin/sh
shebang inside the script.  I understand that the shebang will call out
the desired interpreter i.e. #!/usr/bin/perl, I was simply mistaken in
thinking that sh was equivalent to bash.




reply via email to

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