8 PMdirindex - Poor man's directory index generator, output HTML
27 [ $
[(${#n}-$i)%3] == 1 ] && s
=" " || s
=''
37 if [ .
${1:0:1} = .
- ] && expr "${1:1}" : "[AasrctuvU]\+\$" >/dev
/null
41 echo "$self: ignored: $1" >&2
50 echo "$self: output: $output" >&2
53 echo "$self: $output: already exists." >&2
59 echo "<pre class='poorMansDirecoryIndex'>"
60 echo "date time size name"
61 echo "------------------------- -------------- --------------"
63 ls -1 --group-directories-first ${switch:--At} |
{
66 time=$
(date +'%Y-%m-%d %H:%M:%S %z' -d@$
(stat
-c %Y
"$file"))
67 size
=$
(stat
-c %s
"$file")
68 sz
=`human_number $size`
70 if [ -d "$file" ]; then type=/; size
=''
71 elif [ -L "$file" ]; then type=@
72 elif [ -x "$file" ]; then type=*
74 total
=$
(( total
+size
))
76 printf "%s %14s <a href='%s'>%s</a>%s\n" "$time" "$sz" "$file" "$file" "$type"
79 echo "------------------------- -------------- --------------"
80 printf "%40s\n" "`human_number $total`"