[Novalug] Sample shell code...
Megan Larko
larkoc@iges.org
Thu Feb 22 10:39:59 EST 2007
Beartooth and Company,
I tried the sample shell script posted to NoVALUG List. It worked for me exactly following the
instructions of the kind person who posted it (I deleted the original post so I cannot attribute
correctly).
Beartooth, I had no problem with line 10 and/or any ] issues.
I am re-posting it here for others and a comparison check.
#!/bin/sh
#
LAST=none
for PREPROCESS in $(ps -e | awk '{print $4}') ; do
PROCESS=${PREPROCESS//\/0}
MAN=$(man -f ${PROCESS})
TEST_MAN=${MAN//nothing appropriate}
if [ "${#MAN}" = "${#TEST_MAN}" -a "${PROCESS}" != "${LAST}" ] ; then
LAST=${PROCESS}
echo ${MAN}
echo
fi
done | less
It does a nice, quick job of looking at processing running on the system and then returning a brief
description from the man page of what that process is designed to do. FYI, a "q" exits the job
when it has finished its listing (one will see a colon on a line by itself).
Thank you to the person who shared the code.
megan
More information about the Novalug
mailing list