Sorry, couldn't resist.
The proper way to express that is
ps ax |
awk '($5 == "Stickies.app") { found=1; last }
END { exit 1-found }'
or some such. (Maybe print instead of exit if you want to use standard output directly.)
In particular, we emphasize how the exit code of grep directly gives you "grep | wc -l" in $?, and how picking a good regular expression saves you from having to do "ps | grep whatever | grep -v grep", and how "ps | awk" (a) gives you better control over which line you grab, without requiring a hideous regular expression, and (b) allows you to succinctly map the input to some completely different kind of output conveniently. (You could use perl instead of awk, obviously, if you have more CPU cycles than you can put to good use.)
This is a shell programming Very FAQ, by the way.
While I have your attention (if I do), let me describe what I had to do to get to link to this entry:
1. Read it in the expanded view of your { journal } entries
2. Collapse bodies so the display would include links to the actual entries
3. Navigate back to the particular entry I was reading
4. Click on its (body) link and bookmark.
Now, wouldn't it be nice if the (body) link (or some other sort of "permalink") was always visible, at least in the expanded view?
by
era
2006-06-19 01:23
blog
·
erablog
·
peeve
·
perl
·
rubric
·
shell
·
20060619-0123