Re: Shell script anomaly SOLVED

2002-05-15 Thread Alex Malinovich
On Wed, 2002-05-15 at 06:53, Miquel van Smoorenburg wrote: > In article <[EMAIL PROTECTED]>, > Sure. If your script is called something like "check-xscreensaver" > the grep finds the script itself. > > Why not use "pidof xscreensaver", see man pidof(8) That was it! The script name was 40xscreensa

Re: Shell script anomaly

2002-05-15 Thread Andreas Nowack
On 14 May 2002, Alex Malinovich wrote: > if ps -A |grep -q "[x]screensaver"; then xscreensaver-command -activate > else xscreensaver& xscreensaver-command -activate; fi > > However, if I put that exact line into a shell script and run it, the if > ALWAYS gets evaluated as true. Any ideas? I would

Re: Shell script anomaly

2002-05-15 Thread Miquel van Smoorenburg
In article <[EMAIL PROTECTED]>, Alex Malinovich <[EMAIL PROTECTED]> wrote: >I'm sure that I might be missing something obvious here, but after a few >hours I still haven't figured it out. I'm writing a script to detect >whether xscreensaver is running and activate it if it is. If not, it >launches

Re: Shell script anomaly

2002-05-15 Thread Tom Cook
On 0, Alex Malinovich <[EMAIL PROTECTED]> wrote: > On Tue, 2002-05-14 at 22:06, Craig Dickson wrote: > > I cannot reproduce your symptoms. Whether I type your code in at the > > shell prompt or run it in a script, it always behaves correctly. > > > > You don't say what shell you're using (or what

Re: Shell script anomaly

2002-05-14 Thread Alex Malinovich
On Tue, 2002-05-14 at 22:06, Craig Dickson wrote: > I cannot reproduce your symptoms. Whether I type your code in at the > shell prompt or run it in a script, it always behaves correctly. > > You don't say what shell you're using (or what version); my tests were > performed using the version of ba

Re: Shell script anomaly

2002-05-14 Thread Tom Cook
On 0, Alex Malinovich <[EMAIL PROTECTED]> wrote: > I'm sure that I might be missing something obvious here, but after a few > hours I still haven't figured it out. I'm writing a script to detect > whether xscreensaver is running and activate it if it is. If not, it > launches the daemon first and

Re: Shell script anomaly

2002-05-14 Thread Craig Dickson
begin Sean 'Shaleh' Perry quotation: > I could be wrong but I think the if is checking whether ps returned > successfully or not. I don't think so. It should be checking the return code of the final command in the pipe, which in this case is grep. Craig pgppIOVwsLwO9.pgp Description: PGP sig

Re: Shell script anomaly

2002-05-14 Thread Sean 'Shaleh' Perry
On 15-May-2002 Alex Malinovich wrote: > I'm sure that I might be missing something obvious here, but after a few > hours I still haven't figured it out. I'm writing a script to detect > whether xscreensaver is running and activate it if it is. If not, it > launches the daemon first and then activa

Re: Shell script anomaly

2002-05-14 Thread Craig Dickson
begin Alex Malinovich quotation: > I'm sure that I might be missing something obvious here, but after a few > hours I still haven't figured it out. I'm writing a script to detect > whether xscreensaver is running and activate it if it is. If not, it > launches the daemon first and then activates