34 lines
757 B
Bash
34 lines
757 B
Bash
#!/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${NC}"
|
||
|
|
return 1
|
||
|
|
}
|
||
|
|
|
||
|
|
# Check shell syntax
|
||
|
|
if ! bash -n "$script"; then
|
||
|
|
echo -e "${RED}Syntax error found${NC}"
|
||
|
|
return 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
echo -e "${GREEN}Syntax OK${NC}"
|
||
|
|
return 0
|
||
|
|
}
|
||
|
|
|
||
|
|
# Find and verify all shell scripts
|
||
|
|
find "$PROJECT_DIR" -type f -name "*.sh" -exec bash -c 'verify_script "$0"' {} \;
|