On 0, Alex Malinovich <demonbane@the-love-shack.net> 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 activates. From the command line, the > following returns the correct exit codes: > > 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? It Works For Me (TM). As someone else has asked, which shell are you using? This works for me in bash 2.05a.0(1)-release (i386-pc-linux-gnu). <the-stupid-question> Maybe you always have xscreensaver running? </the-stupid-question> Of course you don't, do you? Cull the -q and check. Regards, Tom -- Tom Cook Information Technology Services, The University of Adelaide "Other people's priorities are endlessly odd." - Kingsley Amis Get my GPG public key: https://pinky.its.adelaide.edu.au/~tkcook/tom.cook-at-adelaide.edu.au
Attachment:
pgpaptV8S9XQf.pgp
Description: PGP signature