Let me give you an idea of what I am doing.
I am running a script that is doing basic OS processes for two systems Linux and SunOS. Well the first directory it runs is called sol0. The script puts the output of sol0 into a temp file.
It looks like this:
-----------------------
proc 1 response time = 67
proc 2 response time = 114
-----------------------
average response time = 90
completion_time = 170
total idle time = 32
percent idle time = 18%
-----------------------
I am editing the script to make a file in the current directory that stores sol0's output. I want that file to compare to the output of every directory after that.
My cmp command says none of the outputs match even when I made a copy of sol0 with a different name. They both have the same output!
Here is how I am using the command ,but first some details about my script.
My Variables:
STUID=$1
PATH=${PATH}\:.
TMPFILE=tempfile
GDIR=`pwd`
OSNAME=`uname -s`
LOG=${GDIR}/results/${STUID}-${OSNAME}-X.log
DATE=`date`
TT=/dev/tty
file="./"
How the script is calling the function to run:
( if [ ${OSNAME} = SunOS ] ; then
ulimit 65
./sim >>${TMPFILE} 2>${TMPFILE}2 &
else
ulimit 35
./sim >>${TMPFILE} 2>${TMPFILE}2 &
fi
)
The cmd command:
if [ ${STUID} = sol0 ]; then
if [ ${OSNAME} = SunOS ]; then
echo " Making SunOS compare file. " > ${TT}
echo > ${GDIR}/compares
echo " Created file. " > ${TT}
cp ${TMPFILE} ${GDIR}/compares
else
echo " Making Linux compare file. " > ${TT}
echo > ${GDIR}/comparel
echo " Created file. " > ${TT}
cp ${TMPFILE} ${GDIR}/comparel
fi
else
echo " This is not sol0. " > ${TT}
fi
if [ ${OSNAME} = Linux ]; then
if [ ${STUID} != sol0 ]; then
if [ cmp ${TMPFILE} ${GDIR}/comparel ]; then
echo "${STUID} Linux output matches the Linux output of sol0." > ${TT}
else
echo "${STUID} Linux output does not match the Linux output of sol0." >${TT}
fi
else
echo "This is sol0, no comparing will be done." >${TT}
fi
else
echo "This is running on SunOS. " >${TT}
fi