-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_index.sh
More file actions
55 lines (39 loc) · 949 Bytes
/
make_index.sh
File metadata and controls
55 lines (39 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
DNAMES="geo_sample grid_sample"
function MAKE_html()
{
echo "" > menu.html
for dname in $DNAMES
do
echo "<div> <p> $dname </p> " >> menu.html
find $dname -type f -regex '.*\.\(php\|html\)' -printf "<p> <a href=\"%p\"> %f </a>\n" >> menu.html
echo "</div>" >> menu.html
done
}
function GET_files()
{
for dname in $DNAMES
do
find $dname -type f -type f -regex '.*\.\(php\|html\)' -printf "%p\n"
done
}
function MAKE_json()
{
echo "{" > menu.json
echo " \"links\" : [" >> menu.json
GET_files | awk '{
if ( NR > 1 ) printf ",\n";
printf "\"/%s\"", $1 ;
}' >> menu.json
echo " ] " >> menu.json
echo "}" >> menu.json
}
opt=${1:-"json"}
if [ "$opt" == "json" ]
then
MAKE_json
else
GET_files
MAKE_html
fi
ls -al menu.*
#find geo_sample -name "*.html" -printf "<p> <a href=\"%p\"> %f </a>\n" >> menu.html