Created
April 30, 2024 19:44
-
-
Save hadrienblanc/5d4a9ce36ec2d536d37ae69597ebeeb4 to your computer and use it in GitHub Desktop.
Loop through each file in the directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Loop through each file in the directory | |
for file in *; do | |
if [ -f "$file" ]; then # Check if it's a file (and not a directory) | |
echo "Filename: $file" # Print the name of the file | |
cat "$file" # Print the contents of the file | |
echo # Print a newline for better readability between files | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment