#!/bin/bash
SVER='1.0.3'

##############################################################################
#  chktid - TID Checker
#  Copyright (C) 2020-2022 SUSE LLC
#
# Description:  Checks existing patterns for the string given, usually a TID
#               number.
# Modified:     2022 Nov 01
#
##############################################################################
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; version 2 of the License.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, see <http://www.gnu.org/licenses/>.
#
#  Authors/Contributors:
#     Jason Record <jason.record@suse.com>
#
##############################################################################


LCONF='/etc/opt/patdevel/patdev.conf'
[[ -s $LCONF ]] && . $LCONF || { echo "ERROR: File not found, $LCONF"; echo; exit 1; }

clear
echo "Checking Patterns for $1"
echo "Pattern Root Directory: $PATDEV_REPOS_DIR"
cd ${PATDEV_REPOS_DIR}
find ${PATDEV_REPOS_DIR}/ -type f | grep patterns | sort | xargs grep "$1"
echo

