• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright (C) 2017 and later: Unicode, Inc. and others.
4# License & terms of use: http://www.unicode.org/copyright.html
5#
6# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
7
8PRE44=0
9
10# output 4_0 instead of 40
11if [ "$1" == "--pre44sym" ];
12then
13    PRE44=1
14    shift
15fi
16
17INVER="0.0"
18if [ $# -eq 0 ];
19then
20    read INVER
21elif [ $# -eq 1 ];
22then
23    INVER=$1
24else
25    echo "$0: error: require one or zero arguments. If zero, read from stdin" >&2
26    exit 1
27fi
28
29UND=`echo ${INVER} | tr '.' '_'`
30MAJ0=`echo ${UND} | cut -d_ -f1`
31MIN1=`echo ${UND} | cut -d_ -f2`
32if [ ${MAJ0} -lt 49 ];
33then
34    if [ ${PRE44} -eq 0 ];
35    then
36        # pre 50:  paste together "4" and "8" to get 48
37        echo -n "${MAJ0}${MIN1}"
38    else
39        # pre 50: 4_8
40        echo -n "${MAJ0}_${MIN1}"
41    fi
42else
43    # post 50:  just use the first #
44    echo -n "${MAJ0}"
45fi
46
47exit 0
48