Subject: Re: Problem with mutt version.sh script

Derek Martin invalid at pizzashack.org
Wed Apr 18 19:13:51 UTC 2018


On Wed, Apr 18, 2018 at 07:43:34AM -0500, Paul Keusemann wrote:
> Trimming digest, replying inline below...
> 
> On Wed, Apr 18, 2018 at 7:00 AM, <mutt-dev-request at mutt.org> wrote:
> 
> >
> >
> > Message: 4
> > Date: Tue, 17 Apr 2018 14:28:17 -0500
> > From: Derek Martin <invalid at pizzashack.org>
> > To: mutt-dev at mutt.org
> > Subject: Re: Problem with mutt version.sh script
> > Message-ID: <20180417192817.GE13062 at bladeshadow.org>
> > Content-Type: text/plain; charset="utf-8"
> >
> > On Mon, Apr 16, 2018 at 09:26:51AM -0700, Kevin J. McCarthy wrote:
> > > On Mon, Apr 16, 2018 at 10:18:57AM -0400, Aaron Schrab wrote:
> > > > At 15:41 +0200 16 Apr 2018, Gero Treuner <gero-mutt at innocircle.com>
> > wrote:
> > > > > On Mon, Apr 16, 2018 at 07:53:56AM -0500, Paul Keusemann wrote:
> > > > > > { [ -e ".git" ] && command -v git >/dev/null 2>&1; } \
> > > > > > || exec cat VERSION
> > > > > >
> > > > > > does not work when run in a bourne shell.? The -e option is not
> > supported in
> > [...]
> > > Whoops, thank you Paul for pointing this out.
> >
> > One wonders what systems these are, and whether this is even worth
> > considering.  If it is, I believe Bourne shell allows compound tests
> > like the following:
> >
> >   [ -f $file -o -d $file ]
> >
> 
> This is on Solaris 10.  According to the man page for test, the -o <option>
> option is used to check whether or not <option> is on.

Yes, but keep reading.  

[For the peanut gallery, note that the relevant man page *seems to be*
the one for /usr/bin/test on Solaris 10.  That's a bit dubious as most
shells implement test as a built-in (in addition to having the on-disk
implementation) which may or may not behave the same way.  It does
seem to mention shell-specific syntax though, in at least a few cases.
All that said, looking at that man page...]

It also has 

  condition1 -o condition2

Which is what I was referring to.  I'm quite positive I've used this
syntax while doing (genuine) Bourne shell scripting at some point,
most likely on Ultrix circa 1994, but since it was so long ago I can't
be exactly sure when or which exact shell and which exact features
were supported.  Nevertheless, the Solaris 10 man page seems to
confirm that it should work.  I will add a caveat that it may not work
as expected if the parser can't disambiguate the two variants of -o
usage, which may depend on your exact syntax (and how buggy your
Bourne shell is).

Solaris 10 is 16 years old. =8^(  It is sadly not EOL until 2021, but
it's already pretty darn long obsolete.  Case in point.

> > [Although, FWIW, I could have sworn Bourne shell supported -e as
> > well...]
> 
> According to the man page, not available in sh.

Indeed.  But I'm almost certain I've used it with some Bourne shell or
other... my best guess would be HP-UX 9, but it's possible I'm
mis-remembering and it was actually the POSIX shell on HP-UX 10 or
later, or OSF-1, or some other OS entirely.  This would have been in
the time frame of roughly 1994-1998.  The POSIX shell became standard
so long ago that frankly I think Sun should be embarrassed their
default shell isn't POSIX-compatible.

> This is on Solaris 10, x86 and SPARC.  I don't currently have a Solaris 11
> machine running but hope to soon.  Once I get it up and running I can test
> there as well.

All of the suggested options, including the original that caused this
thread, should work correctly on Solaris 11, though the point is moot
since Kevin made the change.

-- 
Derek D. Martin    http://www.pizzashack.org/   GPG Key ID: 0xDFBEAD02
-=-=-=-=-
This message is posted from an invalid address.  Replying to it will result in
undeliverable mail due to spam prevention.  Sorry for the inconvenience.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-dev/attachments/20180418/dc32ad1e/attachment.asc>


More information about the Mutt-dev mailing list