Hi all,
I have a shell programing question. I want to write a test that runs a
certain background program if it doesn't already exist. What I want to
test is this:
If the pid file doesn't exist
or
The pid file relates to a non-existing process
or
The process is not what I'm trying to run
(readlink /proc/`cat /var/run/pid`/exe | grep -q
progname)
will return 0 if it's the right program and 1 if
it's not. In fact,
that's exactly my problem. I want the 0 and 1 to
be reversed. If I did:
You can add -v to the grep command line, it will
reverse its function. Or replace grep -q
Alex Shnitman wrote:
You can add -v to the grep command line, it will
reverse its function.
It may help this particular case, but -v reverses the search criteria,
not the overall result.
Take a file that has the two lines:
1
2
Doing grep 1 file will result in 0 (found), while doing grep -v 1
On Mon, Sep 05, 2005, Shachar Shemesh wrote about Shell programing question:
will return 0 if it's the right program and 1 if it's not. In fact,
that's exactly my problem. I want the 0 and 1 to be reversed. If I did:
Is that your only program - reversing the return code? This is easy, just
use
On 9/5/05, Shachar Shemesh [EMAIL PROTECTED] wrote:
Alex Shnitman wrote:
You can add -v to the grep command line, it will
reverse its function.
It may help this particular case, but -v reverses the search criteria,
not the overall result.
Take a file that has the two lines:
1
2