#!/usr/bin/env bash

# - Read first charactor of a file:
# -
# -    head -c1 <path-to-file>

deb_major_version=""

is_number() {

   return $(test ! -z "${1##*[!0-9]*}" > /dev/null 2>&1);

   # - also possible
   # -
   #[[ ! -z "${1##*[!0-9]*}" ]] && return 0 || return 1
   #return $([[ ! -z "${1##*[!0-9]*}" ]])
}

if [[ -f "/etc/debian_version" ]]; then
   
   deb_major_version=$(head -c1 /etc/debian_version)
   if is_number $deb_major_version ; then
      echo -e "\n\tDebian Major Version: $deb_major_version\n"
   else
      echo -e "\n\tNo numeric Version given. Debian Version: $(head -1 /etc/debian_version)\n"
   fi
else
   echo -e "\nFile '/etc/debian_version' not found"
fi

exit 0
