#!/bin/bash

local=`pwd -P`
login=`whoami`
hostname=`hostname`
if [ ${hostname:0:5} = cicla ] ; then
DODSDIR=/thredds/ipsl
dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
HTML00=http://${dthredds}/$login
machine=ciclad
fi
if [ ${hostname:0:5} = spiri ] ; then
DODSDIR=/thredds/ipsl
dthredds=thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds
HTML00=http://${dthredds}/$login
machine=spirit
fi
if [ ${hostname:0:5} = camel ] ; then
DODSDIR=/thredds/ipsl
fi
if [ ${hostname:0:5} = irene ] ; then
DODSDIR=
fi
if [ ${hostname:0:5} = jean- ] ; then
DODSDIR=
fi


      echo '<h1 ALIGN=CENTER> Liste des séries de simulations préparatoires à CMIP6, LMDZ-Orchidee</h1> '
echo "<table>"
echo "<H1>"


i=1
for f in $DODSDIR/${login}/lmdz/MultiSimu/*/entete.html ; do
    sim=`echo $f | cut -d/ -f7`
# A REFAIRE
echo "<TD ALIGN=LEFT><A HREF=`echo $f | sed -e 's:/thredds/ipsl/:http\://thredds-su.ipsl.fr/thredds/fileServer/ipsl_thredds/:'`> $sim </A> </TD>"

if [ $i = 8 ] ; then
echo "<TR>"
i=0
fi
i=$(( $i + 1 ))

done
echo "</table>"
echo "</H1>"

