if [ -f $1 ]; then

  if [[ ! -z $2 ]]; then
    echo $2 > $1;
  fi;

  echo `cat $1 | sed -n -e '/\[[^]]/s/^[^[]*\[\([^]]*\)].*$/\1/p'`;

fi;

