Types de fichiers d’un serveur Web

#!/bin/bash

RED='\033[0;31m'
NC='\033[0m'
DIR='/var/www/mysite'

EXTENSIONSET=(
		"HTML		htm*" \
		"CSS		css"  \
		"JS		js"  \
		"PHP		php*"  \
		"Python		py"  \
		"Perl		pl"  \
		"CGI		cgi"  \
		"Ruby		rb"  \
		"XHTML		xhtml"  \
		"XML		xml"  \
		"YAML		yml"  \
		"TOML		toml"  \
		"C#		cs"  \
		"Java		java"  \
		"JSP		jsp"  \
		"ASP		asp*"  \
		"VB		vb"  \
		"Flash		swf"  \
		"AS		as*"  \
		"MD		md"  \
		"TXT		txt"  \
)

if [ ! -d ${DIR} ]; then
        echo "Le répertoire cible n'existe pas..."
        exit 1
fi

search() {

		result=$(find ${DIR} -type f -iname "*.${2}" | wc -l)
		echo -e "${1}\t\t" "${RED}${result}${NC}"
}

echo "-----------------------"

for EXT in "${EXTENSIONSET[@]}"
do
	search ${EXT}
done

echo "-----------------------"
$ bash wwwsearch.sh
-----------------------
HTML		 2
CSS		 371
JS		 578
PHP		 1014
Python		 0
Perl		 0
CGI		 0
Ruby		 0
XHTML		 0
XML		 2
YAML		 0
TOML		 0
C#		 0
Java		 0
JSP		 0
ASP		 0
VB		 0
Flash		 0
AS		 1
MD		 6
TXT		 16
-----------------------

Fermer le menu