#!/bin/bash

# -------------------------------------------------------
# RPC Project :
# Run RPC_info_rff_dir : return main infos of all 
#                         RFF files of a given dir
# P. Robert, LPP, 2011-08-24
# -------------------------------------------------------

appli=`basename $0`
appli36=`echo "$appli                                 " | cut -c1-36`
Narg=1

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
   then
   echo "$appli : return main infos of all RFF files of a given dir"
   echo "$appli   require $Narg argument(s), ex:"
   echo "$appli   toto"
   echo "    toto : name of a directory containing RFF files"
   echo ""
   if test $hh = 1 ; then exit 0 ; fi
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 1
fi

if ! test -d $1
   then
   echo "directory $1 does not exist"
   echo ""
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 2
fi

ls $1/*.rff > toto1_$$
sed "s/^/RPC_info_rff /" toto1_$$ > toto2_$$
\rm toto1_$$
sh toto2_$$
\rm toto2_$$
