#!/usr/bin/env bash IFS=' ' script_dirS=$(cd -P "$(dirname "$BASH_SOURCE")" &>/dev/null && pwd) challenge() { declare -a equals=("Student1 90" "Student2 70" "Student3 50") declare -a differents=("Student1 92" "Student2 75" "Student3 55" "Student4 25") for e in "${equals[@]}"; do name=$(echo "$e" | awk '{print $1}') grade=$(echo "$e" | awk '{print $2}') submitted=$(echo -e "$name $grade" | bash -c ""$script_dirS"/student/grades.sh 1") expected=$(echo -e "$name $grade" | bash -c ""$script_dirS"/solutions/grades.sh 1") diff <(echo "$submitted") <(echo "$expected") done for d in "${differents[@]}"; do name=$(echo "$d" | awk '{print $1}') grade=$(echo "$d" | awk '{print $2}') submitted=$(echo -e "$name $grade" | bash -c ""$script_dirS"/student/grades.sh 1") expected=$(echo -e "$name $grade" | bash -c ""$script_dirS"/solutions/grades.sh 1") diff <(echo "$submitted") <(echo "$expected") done # Testing multiple students submitted=$( bash -c ""$script_dirS"/student/grades.sh 3" <