Hmm... now that I've had a chance to play around with it more, there's a few things that can be changed.
For example, the line above that reads
Code:
for i in `jls | grep -v "JID" | awk '{print $3}'`
...can be changed to...
Code:
for i in `jls | awk '$1 !~ /JID/ {print $3}'`
...and...
Code:
jexec -U root `jls | grep $i | awk '{print $1}'` /usr/sbin/pkg_version -v -L '='
...can be...
Code:
jexec -U root `jls | awk '$3 ~ /'$i'/ {print $1}'` /usr/sbin/pkg_version -v -L '='