H.4 draw_signal.sh

#!/bin/sh  
 
#  
# Visualiza una seņal en formato ASCII almacenada en un fichero  
# gse. 2006  
#  
 
function end {  
#    (echo -e "" >&2)  
#    (echo -n "ESC[1;0m" >&2) # ESC debe ser sustituido por el ASCII 27  
    exit  
}  
 
function help {  
#    (echo -en "ESC[0;33m" >&2) # ESC debe ser sustituido por el ASCII 27  
    (echo -e "draw_signal signal.txt [title]" >&2)  
    (echo -e "" >&2)  
    (echo -e "  signal = ASCII data file" >&2)  
    (echo -e "  title = title of the graph" >&2)  
    (echo -e "" >&2)  
    (echo -e "  Example:" >&2)  
    (echo -e "" >&2)  
    (echo -e "  draw_signal signal.txt" >&2)  
    (echo -e "  draw_signal signal.txt \"Seņal ...\"" >&2)  
    end  
}  
 
if [ -z "$*" ]; then  
    help  
fi  
 
signal=$1  
title=$2  
 
if [ -z $signal ]; then  
  (echo -e "Sorry, missing the file name with the signal ..." >&2)  
  end  
fi  
 
echo "set title \"$title\";\  
 plot \"$signal\" title \"\" with linespoints pt 4 ps 0.5,\  
 \"$signal\" title \"\" with lines lt 3" | gnuplot -persist