#!/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