Advertisement
Guest User

adianti_lint

a guest
Apr 17th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.54 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. error=false
  4.  
  5. while test $# -gt 0; do
  6.     current=$1
  7.     shift
  8.  
  9.     if [ ! -d $current ] && [ ! -f $current ] ; then
  10.         echo "Invalid directory or file: $current"
  11.         error=true
  12.  
  13.         continue
  14.     fi
  15.  
  16.     for file in `find $current -type f -name "*.php"` ; do
  17.         RESULTS=`php -l $file`
  18.  
  19.         if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then
  20.             echo $RESULTS
  21.             error=true
  22.         fi
  23.     done
  24. done
  25.  
  26.  
  27. if [ "$error" = true ] ; then
  28.     exit 1
  29. else
  30.     exit 0
  31. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement