#!/bin/bash
# Directory to read files from (can be passed as an argument)
DIR="${1:-.}" # Default to current directory if no argument is provided
# Check if the provided directory exists
if [ ! -d "$DIR" ]; then
echo "Directory $DIR does not exist."
exit 1
fi
# Iterate over each file in the directory
for file in "$DIR"/*; do
# Check if it's a regular file (not a directory)
if [ -f "$file" ]; then
# Highlight the file name using ANSI escape codes (bright green)
echo -e "\033[1;32m==== $file ====\033[0m"
# Output the contents of the file
cat "$file"
# Print a separator between files
echo -e "\n=========================\n"
fi
done