.linter_shell.sh 528 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/bash
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color

sh_files=$(find . -type f -name "*.sh")
exe_files=$(grep -Erl "#\\!/bin/(bash|sh)" --exclude=*.* package)
files="$sh_files\\n$exe_files"
#find no files
if [[ "$files" == "\\n" ]];then
  echo -e "${YELLOW}No shell files found!${NC}"
  exit 0
fi

#if
echo  -e "$files"| xargs shellcheck -s bash && \
#then
echo "AWESOME! No problems found." ; \
exit 0
#else
sulzbach's avatar
sulzbach committed
21 22
echo -e "Understand errors in: \
${BLUE}https://github.com/koalaman/shellcheck/wiki${NC}"
23
exit 1