small script

Hi,

I am new to unix shell scripting. I just want a little script to check the no. of processes are equal to 8, then echo a successful message otherwise echo a unsuccessful message. Please help.

Thanks.

Maybe something like:

process=`ps -ef | wc -l`

if [ "$process" -eq 8 ]; then
  echo "8 processes running" 
elif [ "$process" -lt 8 ]; then
  echo "Less than 8 processes running"
elif [ "$process" -gt 8 ]; then
  echo "More than 8 processes running"
fi 

Oh no, you're going to get everurs789 an "F" on his homework. :slight_smile:

typeset -i process=$(($(ps -e|wc -l)-1))
[[ $process -eq 8 ]] && echo PASS || echo FAIL

Simple, right?

Thanks a bunch all...