# check if src file is of type link, and whether links to target file if target
# file is specified.
# @params:
#   $1: src file
#   $2: target file, optional
is_link() {
  src_file=$1
  target_file=$2
  result="$(readlink "${src_file}")"
  if [ "$?" != 0 ]; then
    return 1
  fi
  if [ -n "${target_file}" ] && [ "${target_file}" != "${result}" ]; then
    return 1
  fi
}
