of the machines I have available to me (print ${.sh.version}):

93e is just too old
        Version M-12/28/93e
                ./test.ksh: line 64: .sh.file: parameter not set

My mac:
        Version M 1993-12-28 s+


GNU/Linux
        Version M 93s+ 2008-01-31
        Version JM 93t+ 2009-05-01



  Seems the sub-options are returned differently from the version of ksh93s on 
my Mac to the ksh93s on the linux box. So below I have to check for which 
version I am working on.  I would have expected the OPTARG for the sub-option 
to be 20 or 21, from the USAGE description.  Did I define the USAGE 
incorrectly? or am I looking for the suboptions (20 & 21) incorrectly?

  Is there a way to get the version as a numerical value?  So that it can be 
compared to a minimum version that works for this app.  For example the sh. 
compound variable showed up at some point (93m?).

  I see sometimes the date is the third value in the version string, sometimes 
the fourth, sometimes part of the second (at least in the boxes I've looked 
at).  Is there a regex to parse the various version string formats?


Thanks
Eric







USAGE=$'
...
  [10:date?Delivery date (YYYYMMDD or YYYMMDDHH)]:[<value>]
  [11:flag?what type of flag are you setting?]:[<type>]
    {
      [20:aaa?desc of this type]
      [21:bbb?and this does something else]
    }
  [12:user?Retrieve user data]
  [13:media?Retrieve media content]
  [14:verbose?Verbosity is good sometimes]
...
'

...

while getopts "${USAGE}" optchar
do
  case ${optchar} in
    10) dt_date=${OPTARG} ;;
    11)
      if [[ ${.sh.version} == "Version M 1993-12-28 s+" ]]
      then

        # ---------- ---------- ----------
        # this version returns OPTARG as a negative
        # value of what is defined in USAGE
        # ---------- ---------- ----------
        case $(( abs( ${OPTARG} ) )) in

          20) fl_flag='aaa' ;;
          21) fl_flag='bbb' ;;

        esac

      else

        # ---------- ---------- ----------
        # otherwise it doesn't return OPTARG as
        # a defined number in USAGE but the value itself
        # ---------- ---------- ----------
        fl_flag=${OPTARG}

      fi
...




_______________________________________________
ast-users mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-users

Reply via email to