#!/bin/ksh
if [ "`echo -n`" = "-n" ]; then
   C='\c'
   N=
else
   N='-n'
   C=
fi
directory="/usr/local/cwlm/lmgrd"
license="/usr/local/cwlm/license.dat"
log="/usr/local/cwlm/lmgrd.log"
   if [ -f "$HOME/.compuware.rc" ] ; then
     license1=`grep COMPUWARE_SERVER_LICENSE $HOME/.compuware.rc`
     license=`echo $license1|cut -d= -f2`
     log1=`grep COMPUWARE_LOG_FILE $HOME/.compuware.rc`
     log=`echo $log1|cut -d= -f2`
     directory1=`grep COMPUWARE_LICENSE_DIRECTORY $HOME/.compuware.rc`
     directory=`echo $directory1|cut -d= -f2`
     else
       echo "COMPUWARE_SERVER_LICENSE="$license > $HOME/.compuware.rc
       echo "COMPUWARE_LOG_FILE="$log >> $HOME/.compuware.rc
       echo "COMPUWARE_LMGRD="$directory>> $HOME/.compuware.rc
   fi
       echo "Current .compuware.rc"
       grep 'COMPUWARE_SERVER_LICENSE' $HOME/.compuware.rc
       grep 'COMPUWARE_LOG_FILE' $HOME/.compuware.rc
       grep 'COMPUWARE_LMGRD' $HOME/.compuware.rc
  C=Z
   echo $N "Do you want to change an entry y/n? "
   read con
while : 
do
  if [ $con = "Y" ] || [ $con = "y" ]
   then
echo $N "Input the COMPUWARE_SERVER_LICENSE  (default = $license) "
read tmp
if [ -n "$tmp" ]; then
   license=$tmp
fi
echo $N "Input the COMPUWARE_LOG_FILE (default = $log) "
read tmp
if [ -n "$tmp" ]; then
   log=$tmp
fi
echo $N "Input the COMPUWARE_LMGRD (default = $directory) "
read tmp
if [ -n "$tmp" ]; then
   directory=$tmp
fi
       echo "COMPUWARE_SERVER_LICENSE="$license > $HOME/.compuware.rc
       echo "COMPUWARE_LOG_FILE="$log >> $HOME/.compuware.rc
       echo "COMPUWARE_LMGRD="$directory>> $HOME/.compuware.rc
       echo "Current .compuware.rc"
       grep 'COMPUWARE_SERVER_LICENSE' $HOME/.compuware.rc
       grep 'COMPUWARE_LOG_FILE' $HOME/.compuware.rc
       grep 'COMPUWARE_LMGRD' $HOME/.compuware.rc
   echo $N "Do you want to change an entry y/n? "
   read con
   else
      break
   fi
done

