#!/bin/bash

# exit this script if any error occurs
set -e

# get the directory where this script is in
SCRIPTDIR="$(realpath -s "$(dirname "$0")")"

# define sample solution
SAMPLE_SOLUTION="$HOME
$PROJECT
$SCRATCH"
SOLUTION_FILE="${SCRIPTDIR}/paths.txt"

# check if the solution file exists
if [ ! -f "${SOLUTION_FILE}" ]; then
  echo "ERROR: No solution file found!"
  exit 1
fi

diff <(echo -e "$SAMPLE_SOLUTION") "$SOLUTION_FILE" > /dev/null \
  && echo "Congratulations! Task solved correctly." \
  || echo "ERROR: The solution file does not contain the expected output!"

# exit the script with zero exit code
exit 0
