APL/HTML/TP01/Exercice6.sh

11 lines
380 B
Bash
Raw Permalink Normal View History

2021-11-30 15:06:27 +01:00
#!/bin/bash
printf "<!DOCTYPE html>\n<html lang=\"fr-FR\">\n<body>\n" > $2
printf "<h1>"$(readlink -f $1)"</h1>\n" >> $2
printf "<table>\n<thead>\n<tr>\n<th>Nom du fichier</th>\n<th>Droits</th>\n<th>Taille</th>\n</tr>\n</thead>" >> $2
for file in $(ls $1)
do
stat $file --format="<tr><td>%n</td><td>%A</td><td>%s</td></tr>" >> $2
done
printf "</table>\n</body>\n</html>" >> $2