#!/bin/bash
PrOgRaM="${0##*/}" ### PrOgRaM="`basename "$0"`"
function Error_Avortant(){ echo -e "\nERROR a ${PrOgRaM}: ${1}.\nAvortant...\n" ;  exit $2 ; }
#
[ $# -ne 1 -o -z "$1" -o "${1:0:1}" = "-" ] && echo "Us: ${PrOgRaM} <nom_de_fitxer>" && exit 1
[ -r "$1" ] || Error_Avortant "fitxer '${1}' no trobat" 5
Nompng="${1%.*}.png"
#
echo "unset key;
  set terminal pngcairo size 800,600 enhanced font 'Verdana,11'
  set notitle;
  set output \"${Nompng}\" ;
  plot \"${1}\" with lines ;" | gnuplot
#

