#!/bin/bash # Colors for output GREEN='\033[0;32m' RED='\033[0;31m' BLUE='\033[0;34m' NC='\033[0m' # Get project directory PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Function to verify a shell script verify_script() { local script="$1" echo -e "${BLUE}Checking: ${script}${NC}" # Check if file exists if [[ ! -f "$script" ]]; then echo -e "${RED}Error: File not found - $script${NC}" return 1 fi # Check shell syntax if ! bash -n "$script"; then echo -e "${RED}Syntax error found in $script${NC}" return 1 fi # Check for common shell script issues if command -v shellcheck >/dev/null 2>&1; then if ! shellcheck "$script"; then echo -e "${RED}ShellCheck found issues in $script${NC}" return 1 fi fi echo -e "${GREEN}Script $script passed verification${NC}" return 0 } # Main execution echo "Starting script verification..." # Find and verify all shell scripts find "$PROJECT_DIR" -type f -name "*.sh" | while read -r script; do verify_script "$script" done