From owner-freebsd-questions@FreeBSD.ORG Mon Apr 17 16:58:23 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 14EBA16A400 for ; Mon, 17 Apr 2006 16:58:23 +0000 (UTC) (envelope-from pbowen@fastmail.fm) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id AFBCA43D49 for ; Mon, 17 Apr 2006 16:58:21 +0000 (GMT) (envelope-from pbowen@fastmail.fm) Received: from frontend2.internal (frontend2.internal [10.202.2.151]) by frontend1.messagingengine.com (Postfix) with ESMTP id E1D06D4C5EF for ; Mon, 17 Apr 2006 12:58:20 -0400 (EDT) Received: from frontend3.messagingengine.com ([10.202.2.152]) by frontend2.internal (MEProxy); Mon, 17 Apr 2006 12:57:50 -0400 X-Sasl-enc: GJ94yUY+/xLqmE/DNS3bhM055kQZBRjivAu3P8JKmSC4 1145293068 Received: from [192.168.1.200] (unknown [205.246.14.237]) by frontend3.messagingengine.com (Postfix) with ESMTP id 5054F867B for ; Mon, 17 Apr 2006 12:57:46 -0400 (EDT) Message-ID: <4443C928.5040004@fastmail.fm> Date: Mon, 17 Apr 2006 11:58:16 -0500 From: Patrick Bowen User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4443C6D6.3040707@locolomo.org> In-Reply-To: <4443C6D6.3040707@locolomo.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: getting a user's home dir (sed/awk?) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Apr 2006 16:58:23 -0000 Erik Norgaard wrote: >Hi: > >I am trying to create a script, the idea is to host a number of web >services, each running as a different process owned by a different user >bound to a non privileged port on localhost. The point is that each >service can be restarted without affecting other services and that any >security compromise does not propagate to other services. > >Now, to start all servers I want to create a master script that looks up >the user's home directory and runs a script in a predefined path. > >So the question is: given a username, how do I get the homedir? > >I have found "pw usershow user1" will return a line from the passwd >file, but that needs to be split chewed, and spit out. Seems awk can do >it but I have no clue. > >Thanks, Erik > >PS: Yes, I know, I could just create a perl script - but this time I >want to do it all using the tools in base. > > Erik; How 'bout something like; pw usershow user1 | awk -F: ' { print $9 } ' Patrick