#!/bin/bash

######################
# Just print $UNIXROOT
######################

readonly kitexe="unix";
readonly kitrun="crwrun";
readonly thekit="crwkit";
readonly scriptfile="${BASH_SOURCE[0]}";
readonly scriptname="$(basename $scriptfile)";
readonly versionstr="$scriptname version 1.0 built 20230610";
readonly copyrights="Copyright (c) 2023 Alexey Kuryakin daqgroup@mail.ru";
readonly thekitinfo="This tool is part of $thekit to be run via {$thekit, $kitrun or $kitexe} wrapper.";

if [[ -n "$1" ]]; then
 case $1 in
  --version|-version)       echo "$versionstr";
                            exit 0;
                            ;;
  --copyright|-copyright)   echo "$copyrights";
                            exit 0;
                            ;;
  -h|--help|-help)          echo "$versionstr";
                            echo "$copyrights";
                            echo "Print environment variable UNIXROOT=\$UNIXROOT (default) or \$UNIXROOT (short form).";
                            echo "Usage: $scriptname [-option]";
                            echo "Option: --version    print version.";
                            echo "        --copyright  print copiright.";
                            echo "        -h,--help    print help.";
                            echo "        -s,--short   short print.";
                            echo "Examples:";
                            echo " $kitexe $scriptname";
                            echo " $kitexe $scriptname -s";
                            echo " export \$($kitexe $scriptname)";
                            exit 0;
                            ;;
  -s|--short|-short)        echo "$UNIXROOT";
                            exit 0;
                            ;;
  *)                        ;;
 esac;
fi;

echo "UNIXROOT=$UNIXROOT";

##############
## END OF FILE
##############
