rj wrote:
>
> Try something like:
>
> if{ps -elf | grep 'program_name' | wc -l} > 1 then 'program_name'
>
> should be "running".
>
<snipped double quoted>
What shell are running? It will not run, because the syntax is weird (
'>' is redirection in _all_ shells I know). Instead use this (in bash,
as this is the standard sh in Linux):
Q> if [ $(ps aux | grep "$PRG_NAME" | wc -l) -gt 1 ]; then
Q> echo "one instance of $PRG_NAME is running"
Q> else
Q> echo "no instance of $PRG_NAME is currently running"
Q> fi
or this (in Perl):
Q> if ( `ps aux | grep $prg_name | wc -l` > 1 ) {
Q> print "one instance of $prg_name is running\n";
Q> } else {
Q> print "no instance of $prg_name is currently running";
Q> };
Marc
--
Marc Mutz <[EMAIL PROTECTED]> http://marc.mutz.com/
University of Bielefeld, Dep. of Mathematics / Dep. of Physics
PGP-keyID's: 0xd46ce9ab (RSA), 0x7ae55b9e (DSS/DH)