Number of running Processes

Is there any way to find out how man instances of a certent app are running. Im writing a script to number my Eterms so i can keep track of them in the ALT-Tab window.

c=`ps -a|grep -i eterm|wc|sed 's/^ *//'|sed 's/ .*$//'`
echo $c

Greetings, Mark

or even simpler:

c=`ps -a|grep Eterm|wc -l`
echo $c

ps -a shows all processes
grep Eterm extracts the lines with “Eterm”
wc -l counts these lines.


pgrep gv | wc -l

is another way. Note that in the case of:

c=`ps -a|grep Eterm|wc -l`

… the use of ‘wc’ is useless – let grep do the counting for you:

c=`ps -a|grep -c Eterm`

– Thomas Adam

Or then you could use

Style * IndexedWindowName

Thanks for the help guys. Works like a charm.