Skip to content

Instantly share code, notes, and snippets.

@all3kcis
Last active June 3, 2016 07:42
Show Gist options
  • Save all3kcis/1f5d736ee2a967a4523bbb24404367bc to your computer and use it in GitHub Desktop.
Save all3kcis/1f5d736ee2a967a4523bbb24404367bc to your computer and use it in GitHub Desktop.
search file with extension
#!/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