#!/bin/bash # Check if a file argument is provided if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi TEXT_FILE=$1 # Step 2: make fclean make fclean # Step 3: make with FLAGS make -j4 FLAGS="-DNOCOLORS -DNOBANNER -DNOPROMPT" # Add 'export PS1=">"' to the start of the TEXT_FILE sed -i '1i export PS1="$"' "$TEXT_FILE" # Step 4: Run ./minishell with the text file as input and redirect output to a temp file ./minishell < "$TEXT_FILE" > minishell_output.txt 2>&1 # Step 5: Run bash with the text file as input and redirect output to a temp file export PS1=">"; bash -i < "$TEXT_FILE" > bash_output.txt 2>&1 # Remove the first line of minishell_output.txt and bash_output.txt sed -i '1d' "$TEXT_FILE" sed -i '1d' minishell_output.txt sed -i '1d' bash_output.txt # Step 6: Compare the output files with diff and show the result diff -u --color minishell_output.txt bash_output.txt # Remove the temp files rm minishell_output.txt bash_output.txt