#!/bin/tcsh -f ### produce .ps|.png|.gif from .gp and view it with gv|xv ### gpgp file[.gp] (also called by gplot to do plotting) #set fl = "$1" if ( "$1" == "" ) then echo -n "--- enter .gp file : " set fl = $< endif ###-------------- strip off .gp to get base: set fl = `basename "$1" .gp` ###------------- gunzip datafiles if .gz --------- set datafiles = `grep ' with lines' $fl.gp | awk -F '"' '{print $2}' | uniq -u` if( `echo "$datafiles"` == "" ) goto doPLOT #...... else: #echo " datafiles: $datafiles" echo "" foreach name (`echo $datafiles`) if( -f "${name}.gz" ) then echo " ... found $name.gz ... will gunzip it ..." gunzip ${name}.gz endif end doPLOT: #------- gnuplot $fl.gp to produce $fl.ps|.png|.gif, and gv|xv the .ps: gnuplot < $fl.gp echo "" if( -f "$fl.png" ) then xv $fl.png rm -i $fl.png else if( -f "$fl.gif" ) then xv $fl.gif rm -i $fl.gif else if( -f "$fl.ps" ) then echo -n " gv the .ps ? n for NOT : " set yes = $< if( "$yes" != "n" ) gv $fl.ps & sleep 1 rm -i $fl.ps else if( -f "$fl.eps" ) then echo -n " gv the .eps ? n for NOT : " set yes = $< if( "$yes" != "n" ) gv $fl.eps & rm -i $fl.eps endif echo "" if( `echo "$datafiles"` == "" ) exit echo -n " ---> gzip $datafiles ? n for NOT : " set yes = $< if( "$yes" != "n" ) gzip $datafiles exit