Re: Shell script anomaly
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 test the output of grep. So change the line to
if ps -A |grep -q "[x]screensaver" > /tmp/grep_output; then ...
and look at /tmp/grep_output and you will see why grep returns true.
Best regards,
Andreas
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: