PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > Testing for >= ksh93
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

Testing for >= ksh93

Réponse
 
LinkBack Outils de la discussion
Vieux 07/09/2007, 06h26   #1
whystopnow
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Testing for >= ksh93

Is there a way to test in a script if the version of ksh is >= ksh93?

I thought about examining ${.sh.version}, which is set to something
like "Version M 1993-12-28 s+". I could grep for 1993, but of course
someday when ksh200x comes out, that will fail.

I suppose I could parse out the year and test it as an integer to be
>= 1993. But I'm not sure that the version string is guaranteed to be

in that format.

I could I suppose try to use some ksh93-specific feature in an eval
and see if it works.

Any other ideas?

Thanks.

  Réponse avec citation
Vieux 07/09/2007, 10h01   #2
Janis Papanagnou
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

whystopnow wrote:
> Is there a way to test in a script if the version of ksh is >= ksh93?
>
> I thought about examining ${.sh.version}, which is set to something
> like "Version M 1993-12-28 s+". I could grep for 1993, but of course
> someday when ksh200x comes out, that will fail.


(I not yet see any ksh200x; they're still talking about fixing and
working on ksh93.)

> I suppose I could parse out the year and test it as an integer to be
>
> >= 1993. But I'm not sure that the version string is guaranteed to be

>
> in that format.


I would indeed go that way. And since they are using an ISO standard
date schema you can be quite sure that there will be a YYYY-MM-DD
string in that variable.

> I could I suppose try to use some ksh93-specific feature in an eval
> and see if it works.


${.sh.version} is a ksh93-specific feature.

> Any other ideas?


In the first place I wouldn't check for 200x versions, because any
feature that is not yet deprecated would very likely be supported
by a ksh200x.

If you like to heavily restrict yourself you can also completely
avoid any features that are not defined in POSIX; that way you'll
gain a better portability (in any non-ancient Unix environments).

Janis

> Thanks.
>

  Réponse avec citation
Vieux 07/09/2007, 12h04   #3
wendlin1974@googlemail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93


whystopnow wrote:
> Is there a way to test in a script if the version of ksh is >= ksh93?
>
> I thought about examining ${.sh.version}, which is set to something
> like "Version M 1993-12-28 s+". I could grep for 1993, but of course
> someday when ksh200x comes out, that will fail.
>
> I suppose I could parse out the year and test it as an integer to be
> >= 1993. But I'm not sure that the version string is guaranteed to be

> in that format.
>
> I could I suppose try to use some ksh93-specific feature in an eval
> and see if it works.
>
> Any other ideas?


Try to ask in the ksh93-integration-discuss@opensolaris.org forum,
David Korn himself answers questions there.

>
> Thanks.


--
Wendy

  Réponse avec citation
Vieux 07/09/2007, 17h41   #4
Richard T. Kus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

According to whystopnow <whystopnow@gmail.com>:
:Is there a way to test in a script if the version of ksh is >= ksh93?
:
:I thought about examining ${.sh.version}, which is set to something
:like "Version M 1993-12-28 s+". I could grep for 1993, but of course
:someday when ksh200x comes out, that will fail.
:
:I suppose I could parse out the year and test it as an integer to be
:>= 1993. But I'm not sure that the version string is guaranteed to be
:in that format.
:
:I could I suppose try to use some ksh93-specific feature in an eval
:and see if it works.
:
:Any other ideas?
:
:Thanks.
:

How about just check if .sh_version option. is valid; since ksh93 .sh_*
and not ksh88.

richk
  Réponse avec citation
Vieux 07/09/2007, 21h00   #5
John DuBois
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

In article <1189142780.615531.244820@w3g2000hsg.googlegroups. com>,
whystopnow <whystopnow@gmail.com> wrote:
>Is there a way to test in a script if the version of ksh is >= ksh93?
>
>I thought about examining ${.sh.version}, which is set to something
>like "Version M 1993-12-28 s+". I could grep for 1993, but of course
>someday when ksh200x comes out, that will fail.
>
>I suppose I could parse out the year and test it as an integer to be
>>= 1993. But I'm not sure that the version string is guaranteed to be

>in that format.
>
>I could I suppose try to use some ksh93-specific feature in an eval
>and see if it works.


Instead of testing for ksh93 in general, I usually test for the specific
features I actually *need*.

John
--
John DuBois spcecdt@armory.com KC6QKZ/AE http://www.armory.com/~spcecdt/
  Réponse avec citation
Vieux 08/09/2007, 10h58   #6
Geoff Clare
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

wendlin1974 wrote:

> whystopnow wrote:
>> Is there a way to test in a script if the version of ksh is >= ksh93?


> Try to ask in the ksh93-integration-discuss@opensolaris.org forum,
> David Korn himself answers questions there.


That forum is not for general questions about ksh93. It is a place to
discuss issues related to the integration of ksh93 into OpenSolaris.

--
Geoff Clare <netnews@gclare.org.uk>
  Réponse avec citation
Vieux 11/09/2007, 04h33   #7
bsh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

Geoff Clare <ge...@clare.See-My-Signature.invalid> wrote:
> wendlin1974 wrote:
> > whystopnow wrote:
> > > ...

> That forum is not for general questions about ksh93. It is a place to
> discuss issues related to the integration of ksh93 into OpenSolaris.


The "appropriate" forum is https://mailman.research.att.com/pipermail/ast-users/;
however, don't post there with a newby question or you
WILL get flamed. C.U.S. is better. And we're nicer, too

For a survey of past programmatic solutions, see:

http://groups.google.com/group/comp....bc8f9e5d362bf2

And, for completeness, a survey of various probes scripts,
including the above:

http://groups.google.com/group/comp....a0bcd47c5f2d6c

You should be aware that I have stopped developing whichshell,
in large part because of a recent interchange between Zdenek
Sekera and I. The canonical shells are both changing too fast,
and whose feature sets are converging to standards compliance,
making version discrimination problematic. Another modality
must now be pursued rather than detection of documented syntax
and exploitation of shell idioms.

The aforementioned advice given is probably sufficient. Try:

shver=` print -- ${.sh.version//!([0-9-])/} ` 2>/dev/null # not tested

It's too bad my function toolkit for version compliance is
not yet ready for distribution. It both emulates modern shell
functionality for older shells (like autoloading) as well as
providing a transparent abstraction layer to redirect autoloading
to the appropriate function version (that is, one for each shell),
plus a downward compatible function library for the "lowest
common denominator" of expected functionality written in
acceptably efficient code. Now _that_ would have been the
real solution....

=Brian

  Réponse avec citation
Vieux 26/09/2007, 00h42   #8
Roland Mainz
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Testing for >= ksh93

Geoff Clare wrote:
> wendlin1974 wrote:
> > whystopnow wrote:
> >> Is there a way to test in a script if the version of ksh is >= ksh93?

>
> > Try to ask in the ksh93-integration-discuss@opensolaris.org forum,
> > David Korn himself answers questions there.

>
> That forum is not for general questions about ksh93. It is a place to
> discuss issues related to the integration of ksh93 into OpenSolaris.


Erm... IMO there is no problem with asking general-purpose questions in
that list[1] (however the more or less "official" ksh93 list is the
"ast-users" list (see
https://mailman.research.att.com/pipermail/ast-users/)) ...

[1]=(...and before someone starts to complain: I'm the list admin of the
ksh93-integration@opensolaris.org list...)

----

Bye,
Roland

--
__ . . __
(o.\ \/ /.o) roland.mainz@nrubsig.org
\__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer
/O /==\ O\ TEL +49 641 7950090
(;O/ \/ \O
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 09h56.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,17071 seconds with 16 queries