Skip to content

Instantly share code, notes, and snippets.

@XIIIVI
Last active June 25, 2020 13:32
Show Gist options
  • Save XIIIVI/607e1973e6da1ea014f55976e0a1847f to your computer and use it in GitHub Desktop.
Save XIIIVI/607e1973e6da1ea014f55976e0a1847f to your computer and use it in GitHub Desktop.
#
# is_file_included
# - param1: original file
# - param2: contained file
#
is_file_included() {
local ORIGINAL_FILE=${WORKDIR}/file1
local CONTAINED_FILE=${WORKDIR}/file2
# Remove all the blank lines
# Trim each line
awk NF ${1} | awk '{$1=$1;print}' > ${ORIGINAL_FILE}
awk NF ${2} | awk '{$1=$1;print}' > ${CONTAINED_FILE}
if [ "$(grep -Fxf ${ORIGINAL_FILE} ${CONTAINED_FILE})" = "$(cat ${CONTAINED_FILE})" ]; then
echo "true"
else
echo "false"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment