#!/bin/bash

# -------------------------------------------------------
# RPC Project :
# Run RPC_clean_dir : remove *.in *.out *.old toto*.tmp of current dir
# P. Robert, LPP, 2011-03-21
# -------------------------------------------------------

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

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

if test $# != $Narg || test $hh = 1
   then
   echo "$appli : remove remove *.in *.out *.old *.tmp of the current directory"
   echo "$appli   require $Narg argument(s)"
   echo "$appli   with -a remove also *.ps *.png *.pdf"
   echo " "
   echo "example:"
   echo "$appli"
   echo ""
   if test $hh = 1 ; then exit 0 ; fi
   if test $aa = 0
      then 
      echo "$appli36 : *** ERROR ! Command aborted." >&2
      exit 1
   fi
fi

echo " ------------------------------------------------------------------"
echo " $appli :"
echo " remove  *.in *.out *.old  *.tmp of the current directory"
rm -f *.in *.out *.old *.tmp 

if test $aa = 1 
   then
   echo " remove  *.ps *.png *.pdf  of the current directory"
   rm -f *.ps *.png *.pdf
fi

echo " done..."
echo " ------------------------------------------------------------------"
