OT - shell script to kill a process

Chris Sheffield cmsheffield at gmail.com
Tue Jul 10 13:01:29 EDT 2007


Excellent. That seems to work just fine. Although I had to change the  
2 to 1, since the pid is the first column returned.

I'm running 10.4.10. What's different on yours?


On Jul 10, 2007, at 10:55 AM, chris bohnert wrote:

> Chris,
>
> Try this:
>
>  ps -awx | awk '{print $2}'
>
> if that prints you a list of pid's you should be good to replace  
> the cut
> pipe with the awk command.  By the way, what version of os X are you
> running..mine doesn't seem to behave as you describe.
>
> --
> cb
>
> On 7/10/07, Chris Sheffield <cmsheffield at gmail.com> wrote:
>>
>> Okay, I think I figured out the problem.
>>
>> The pid as returned from ps has a different number of leading spaces
>> depending on the number of digits in the pid. So using a set value
>> for the -f option doesn't seem to work. For example, if the pid has
>> four digits, using 2 works since the pid has 2 leading spaces. But if
>> it has 3 digits, you have to use 3 to get the pid returned correctly
>> since it has 3 leading spaces. Am I making sense? It's kind of
>> confusing to me. Anyway, can you think of a way around this? Is there
>> some other command that would work instead of cut, or some other form
>> of cut maybe?
>>
>> Thanks again.
>>
>>
>> On Jul 10, 2007, at 9:28 AM, Chris Sheffield wrote:
>>
>> >
>> > I've got another question for you though. It concerns the 'cut -d\
>> > -f2' part of this. This doesn't seem to be working correctly. Can
>> > you explain more what's supposed to happen here? It seems to just
>> > be returning an empty string, so a valid pid is never passed on.
>> > I've tried it using TextEdit as well as using my own process in the
>> > command. Any thoughts?
>>
>> ------------------------------------------
>> Chris Sheffield
>> Read Naturally
>> The Fluency Company
>> http://www.readnaturally.com
>> ------------------------------------------
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list