From owner-freebsd-questions@FreeBSD.ORG Mon Apr 17 16:48:38 2006 Return-Path: X-Original-To: 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 42FEE16A42C for ; Mon, 17 Apr 2006 16:48:37 +0000 (UTC) (envelope-from norgaard@locolomo.org) Received: from strange.daemonsecurity.com (59.Red-81-33-11.staticIP.rima-tde.net [81.33.11.59]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6165843D48 for ; Mon, 17 Apr 2006 16:48:33 +0000 (GMT) (envelope-from norgaard@locolomo.org) Received: from [172.24.8.84] (generic.atosorigin.es [212.170.156.200]) by strange.daemonsecurity.com (Postfix) with ESMTP id 3F61E2E02B for ; Mon, 17 Apr 2006 18:48:32 +0200 (CEST) Message-ID: <4443C6D6.3040707@locolomo.org> Date: Mon, 17 Apr 2006 18:48:22 +0200 From: Erik Norgaard User-Agent: Thunderbird 1.5 (X11/20060118) MIME-Version: 1.0 To: questions@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Subject: 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:48:38 -0000 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. -- Ph: +34.666334818 web: www.locolomo.org S/MIME Certificate: www.daemonsecurity.com/ca/8D03551FFCE04F06.crt Subject ID: 9E:AA:18:E6:94:7A:91:44:0A:E4:DD:87:73:7F:4E:82:E7:08:9C:72 Fingerprint: 5B:D5:1E:3E:47:E7:EC:1C:4C:C8:3A:19:CC:AE:14:F5:DF:18:0F:B9