#!/bin/bash compare_shells() { minishell_output=$(../minishell -c "$1" 2>&1) minishell_exit_code=$? bash_output=$(bash -c "$1" 2>&1 | sed 's/ line 1://g') bash_exit_code=$? echo -e "\e[33m$1\e[0m" echo "===================================" if [ "$minishell_output" != "$bash_output" ]; then paste <(echo -e "Minishell:\n$minishell_output" | cat -e) <(echo -e "Bash:\n$bash_output" | cat -e) | column -t -s $'\t' else echo -e "\e[32mstdout: Ok!\e[0m" fi if [ $minishell_exit_code -ne $bash_exit_code ]; then echo "Minishell exit code: $minishell_exit_code" echo "Bash exit code: $bash_exit_code" echo "Exit codes do not match." else echo -e "\e[32mexit code: Ok!\e[0m" fi } if [ -z "$1" ]; then echo "Usage: $0 " exit 1 fi while IFS= read -r line; do compare_shells "$line" done < "$1"