ok, here's the output of "find /store -name .lock.pid -exec cat {} \;"
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:02 2008
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:04 2008
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:04 2008
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:02 2008
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:02 2008
chvpklnxq1dev.chvpk.chevrontexaco.net|15734|Tue Feb 12 02:00:04 2008
I'm trying to extract the date so that I can compare it to the current date, using the date command. And then I want to see if they match on each occasion; this is what I've written:
#!/bin/bash
chkdt1=$(date | awk -F " " '{print $2,$3}')
#echo "${chkdt1}";
declare -a lock=$(find /store -name .lock.pid -exec cat {} \

;
chkdt=$(echo "$lock[1]" | awk -F" " '{print $2,$3}');
echo "$lock";
for i in "$lock"
do
if [ "${chkdt}X" != "${chkdt1}X" ]
then
echo "dates don't match";
else
echo "dates do match";
fi
done
============
I'm getting dates don't match; which they should. But HERE'S THE REAL QUESTION...WHY IS IT THAT THE ARRAY IS NOT WORKING..BECAUSE THE $LOCK ECHO IS RETURNING THE WHOLE array instead of the $lock[1] I'm addressing?