#!/bin/sh
source arraystuff.sh
pid="$1";

attach () {
echo "Attaching to $pid";
strace -e trace=read,open,close -p $pid -o $file &
echo "Starting Trace";
}

check () {
while [ 1 ]; do
count_=`wc -l $file | awk '{ print $1 }'`
sleep 2
count1_=`wc -l $file | awk '{ print $1 }'`
if [ "$count_" == "$count1_" ]; then
./arraystuff.sh;
fi
done
}

main1 () {
attach;
check;
 }
main1;
