Skip to content

Instantly share code, notes, and snippets.

@toshimaru
Last active June 27, 2023 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toshimaru/c480bd131c695dd3914dec7b3ea4cdc3 to your computer and use it in GitHub Desktop.
Save toshimaru/c480bd131c695dd3914dec7b3ea4cdc3 to your computer and use it in GitHub Desktop.
A simple bash script that checks for the existence of specified files:
#!/bin/bash
# Define the list of file paths
filelist=(
"config/database.yml"
"config/setting.yml"
"config.yml"
)
# Check for the existence of each file
for file in "${filelist[@]}"
do
if [ -e "$file" ]
then
echo "$file exists."
else
echo "$file does not exist."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment