updated project 2
This commit is contained in:
@@ -11,24 +11,38 @@ PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Function to verify a shell script
|
||||
verify_script() {
|
||||
local script=$1
|
||||
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}"
|
||||
echo -e "${RED}Error: File not found - $script${NC}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Syntax OK${NC}"
|
||||
# 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
|
||||
find "$PROJECT_DIR" -type f -name "*.sh" -exec bash -c 'verify_script "$0"' {} \;
|
||||
Reference in New Issue
Block a user