Kill "loginwindow" process using command line in Mac OS X

macos, unix

Solution

This seems like the long way around. Why not just use `killall loginwindow`?

Problem

So far, I have written the following unix command: ``` ps -Ajc | grep loginwindow | cut -c 16-20 | sed 's/ //g' ``` This grabs the "loginwindow" process, filters it using cut and sed to return the number of the "loginwindow" process. I'd like to know how to use the number retrieved to the process. Thank you.

Original source