Created
September 6, 2021 14:48
-
-
Save 5HT2/746386f36ccabf96c794240c422c7d57 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# This script runs all .sh files, excluding itself, in the directory it's run in. | |
# Get name of self script. Only works when running in current dir, doesn't work with symlinks. I'm lazy. | |
SELF="$(basename "$0")" | |
for file in *.sh; do | |
# Check if script is not self, and is a file | |
if [[ "$file" != "$SELF" ]] && [[ -f "$file" ]]; then | |
# Check if script is not executable | |
if ! [[ -f "$file" ]]; then | |
chmod u+x "$file" | |
fi | |
echo "Running script: $file" | |
./"$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment