#!/bin/bash 
#set -v   # to debug
#set -x   # to debug 
#
#       cambia suffissi a files *.out *.datb 
#

if (( $# != 1 )) ; then
   echo " Uso: mcrename PREFISSO " ;
   echo " Dare il prefisso ....." ;
   exit
fi   

#for i in  *.datb  ; 
#do
#  mv  $i ${1}_datb.${i%.datb}
#done

#for i in  *.out  ; 
#do
#  mv  $i ${1}.${i%.out}
#done

mv  ac.dat ${1}.ac
mv  calo.dat  ${1}.calo
mv  clxcoord.dat  ${1}.clxcoord
mv  clycoord.dat  ${1}.clycoord
mv  stripx.dat  ${1}.stripx
mv  stripy.dat  ${1}.stripy
mv  supsil.dat ${1}.supsil
mv  telem.dat ${1}.telem
mv  activebars.out ${1}.activebars

mv  agile.hist         ${1}.hist
mv  convergenza.out    ${1}.convergenza
mv  exyhist.out        ${1}.exyhist
mv  hitlist_ascii.out  ${1}.hitlist_ascii
mv  hitlist_bin.out    ${1}.hitlist_bin
mv  rec.out            ${1}.rec
mv  summary.out        ${1}.summary
mv  table.out          ${1}.table

cp input.data          ${1}.input

ls -l  ${1}*
