xplot bash script

As an example of how to set up a script to do the above sequence with the additional flexibility of scaling by one of the following normalizations:

#!/bin/bash
 OR=0   #orientation 0=landscape 1=portrait
if test "$1" = "-h"
then
echo "USAGE: xplot  filename  tmax  scaling"
echo 'Scaling Choices:'
echo '1= Peak Absolute Value of profile'
echo '2= L2 Norm of profile'
echo '3= Trace by trace L2 Norm'
else
if test "$1" = ”
then
echo 'Enter input file name'
read FILEN
else
FILEN=$1
fi

if test "$2" = ”
then
echo 'Enter tmax'
read TMAX 
else
TMAX=$2
fi

if test "$3" = ”
then
echo 'Enter Scaling Choice'
echo '1= Peak Absolute Value of profile'
echo '2= L2 Norm of profile'
echo '3= Trace by trace L2 Norm'
read SCL
else
SCL=$3
fi

NAME=`basename $FILEN .seg`
NAME4=`echo $NAME | gawk -F "" '{print $1$2$3$4}' `
case $SCL in
1)
bscl $FILEN 1 5000 3 
AMP=`gawk '/Peak Absolute Value/ {print $4}' bscl$NAME4.lst`
rm -f bscl$NAME4.*
PFILEN=$FILEN
bplt $PFILEN 0 $OR 0 1 500 0 $TMAX 1 $AMP 200
 ;;
2)
bscl $FILEN 1 5000 1
AMP=`gawk '/L2 Norm of Data Set=/ {print $6}' bscl$NAME4.lst`
rm -f bscl$NAME4.*
PFILEN=$FILEN
bplt $PFILEN 0 $OR 0 1 500 0 $TMAX 1 $AMP 200 
;;
3)
bequ $FILEN 0 $TMAX
PFILEN=bequ$NAME4.seg
AMP=4
bplt $PFILEN 0 $OR 0 1 5000 0 $TMAX 1 $AMP 200
rm -f bequ$NAME4.*
;;
esac
rm -f bplt*.lst
fi