From owner-freebsd-questions Thu Jun 21 17:19: 2 2001 Delivered-To: freebsd-questions@freebsd.org Received: from web9402.mail.yahoo.com (web9402.mail.yahoo.com [216.136.129.108]) by hub.freebsd.org (Postfix) with SMTP id 02B6C37B401 for ; Thu, 21 Jun 2001 17:19:00 -0700 (PDT) (envelope-from eric_boucher60@yahoo.com) Message-ID: <20010622001859.52952.qmail@web9402.mail.yahoo.com> Received: from [64.228.188.61] by web9402.mail.yahoo.com; Thu, 21 Jun 2001 17:18:59 PDT Date: Thu, 21 Jun 2001 17:18:59 -0700 (PDT) From: Eric Boucher Subject: TCL: getting the PID of the current process To: FreeBSD MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hi everyone, I want to get the pid of a process in TCL script. What I want to do is to get all the pids of a certain user for example with the command "ps -waux" and let's say I want to kill some. But to do this, I include the following line: set pids [exec ps -waux | grep -i user | cut -c9-19] After, I put it in a list and I want to delete the process that lauch it (so the "ps" command) because everybody knows that when you grep a "ps" command, you always get the pid of the command itself. But if I know the pid of the "ps -waux | grep ..." command, I can delete it from my list. So is there a way to catch the PID of the command you just lauched? In the man of Tcl, it seems that the "pid" command is only used for opening a file. If somebody knows it, can you include a short example please? P.S. If somebody knows a mailing list where I can ask question like you guys at FreeBSD or a newsgroup about TCL/TK, it will be appreciated too. Thanks a lot Eric __________________________________________________ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message