diff --git a/Makefile b/Makefile index 861d9cc..afbb90d 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: qmennen +#+ # # +#+ # # Created: 2024/10/15 11:48:46 by whaffman #+# #+# # -# Updated: 2025/03/01 12:18:10 by whaffman ######## odam.nl # +# Updated: 2025/03/01 12:36:27 by whaffman ######## odam.nl # # # # **************************************************************************** # @@ -73,9 +73,9 @@ $$($(1)_OBJ_PATH): endef # Copy the release build configuration to the root -$(NAME): $(BUILD_PATH)/release/$(NAME) +$(NAME): release $(info $(bold)$(green)Copying release build to root$(reset)) - cp $< $@ + cp ./build/release/minishell $@ $(foreach config,$(BUILD_CONFIGS),$(eval $(call BUILD_TARGETS,$(config)))) diff --git a/inc/minishell.h b/inc/minishell.h index 6dad141..c300333 100644 --- a/inc/minishell.h +++ b/inc/minishell.h @@ -6,7 +6,7 @@ /* By: marvin +#+ */ /* +#+ */ /* Created: 2025/02/04 16:13:13 by whaffman #+# #+# */ -/* Updated: 2025/03/01 11:22:11 by whaffman ######## odam.nl */ +/* Updated: 2025/03/01 12:51:53 by whaffman ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -39,7 +39,7 @@ # endif # ifdef NOPROMPT -# define PROMPT ">" +# define PROMPT "$" # else # define PROMPT 0 # endif diff --git a/test_minishell.sh b/test_minishell.sh new file mode 100755 index 0000000..48a9bbb --- /dev/null +++ b/test_minishell.sh @@ -0,0 +1,35 @@ +#!/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