#!/bin/bash if [[ $# != 1 ]] then echo "Usage: mymem " echo "Example: mymem \"/path/to/jpf DP 4\"" echo echo "This script computes the resident memory for the JVM while running JPF" exit 1 fi $1 & temp="temp.txt" rm -f $temp while [[ `jobs | wc -l` = 1 ]] ; do jobs >> /dev/null mem="`top -n 1 | grep java`" echo $mem | gawk '{ print $6 }' >> $temp done echo ">>> I'm finished !" total=">>> Total memory is `cat $temp | sort | tail -n 1`" echo $total exit 0