Set MBS listmode data file creation time and date

#!/bin/sh
#---------------------------------------------------------
# this small script extracts the MBS file creation time
# from the listmode buffer and sets the file creation date
# accordingly
# Andreas Wagner, Forschungszentrum Dresden-Rossendorf e.V.
# Postfach 510119, 01324 Dresden, Germany
#---------------------------------------------------------
if [ $# -ne 1 ]; then
  echo 1>&2 Error, supply file name. I quit here ...
  exit 127
fi
if [ ! -f $1 ]; then
  echo 1>&2 Error, file not present. I quit here ...
  exit 127
fi
dd if=$1 of=t$$ bs=1 count=24 skip=199 >/dev/null
fdate="`cat t$$ `"
echo $fdate echo "... setting creation time of file "$1" to "$fdate
touch -d "$fdate" $1
rm t$$