Re: Note to all XCompMgr Users



On Tue, Sep 02, 2008 at 06:11:58PM +0200, Janek Kozicki wrote:
> 
> #!/bin/bash
> PID=`ps auxw | grep "janek" | grep -e " xcompmgr$" | fgrep -v "grep" | awk '{print$2}'`
....
Just as aside - the above can be simplified to
PID=$(pgrep -u janek -f xcompmgr)
and if you really want ps and awk then
PID=$(ps auxw | awk '$1 == "janek" && $0 ~ /[x]compmgr/{print $2}').
Also a status from 'killall -u janek -0 xcompmgr 2>/dev/null' can
be used but this does not give PID (which is not that important).

Moreover a string "janek" is likely better replaced above by an
ouput of 'id -un'.

   Michal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]