Last active
June 3, 2016 07:42
-
-
Save all3kcis/1f5d736ee2a967a4523bbb24404367bc to your computer and use it in GitHub Desktop.
search file with extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#set -xv | |
s_path=${1:-.} | |
file_ext=${2:-php} | |
#echo "$file_ext" | |
files=$(find "$s_path" -type f -name "*.$file_ext") | |
#echo "$files" | |
files_found=$(echo "$files" | grep -v '^$' | wc -l) | |
#echo $files_found | |
if [ "$files_found" -ge 1 ] | |
then | |
echo "$(tput setab 7 ; tput setaf 1 ; tput bold)$files_found file(s) found with *.$file_ext on $s_path. $(tput sgr 0)" | |
else | |
echo "Clean !" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment