Re: Truly weird, easy to replicate behaviour...
Re: Truly weird, easy to replicate behaviour...
- Subject: Re: Truly weird, easy to replicate behaviour...
- From: Chris Janton <email@hidden>
- Date: Sat, 29 Mar 2003 09:08:23 -0700
You can do it this way as well
ps -auxcww | grep [S]creenSaver || echo NoneFound
OK - so we make sure we get all of the output (ww) and only look at the
executable (c)
If I use the [S] I can omit the "c" flag - the regular expression
works, but won't match itself ;-)
at the end we put "|| echo NoneFound" which tells sh to output the
string NoneFound in case the grep fails.
What happens in the original case is that grep doesn't find the string,
so it exits with an error status. The error gets passed back to your
script...
You get to do it either way...
set myMessage to "NoProcess"
try
set myMessage to (do shell script "ps -ax | grep [S]creenSaver")
end try
display dialog myMessage
or
display dialog (do shell script "ps -ax | grep [S]creenSaver || echo
NoProcess")
take your pick...
8)
----------------------------------
Chris Janton - face at CentosPrime dot COM
Netminder for Opus1.COM
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.