From owner-freebsd-questions@FreeBSD.ORG Mon Apr 17 18:11:03 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 4847116A400 for ; Mon, 17 Apr 2006 18:11:03 +0000 (UTC) (envelope-from nvass@teledomenet.gr) Received: from matrix.teledomenet.gr (dns1.teledomenet.gr [213.142.128.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 84C5C43D4C for ; Mon, 17 Apr 2006 18:11:01 +0000 (GMT) (envelope-from nvass@teledomenet.gr) Received: from [192.168.1.71] ([192.168.1.71]) by matrix.teledomenet.gr (8.12.10/8.12.10) with ESMTP id k3HIB0dP005855; Mon, 17 Apr 2006 21:11:00 +0300 From: Nikos Vassiliadis To: freebsd-questions@freebsd.org Date: Mon, 17 Apr 2006 21:09:22 +0300 User-Agent: KMail/1.9.1 References: <4443C6D6.3040707@locolomo.org> In-Reply-To: <4443C6D6.3040707@locolomo.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200604172109.22366.nvass@teledomenet.gr> Cc: 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 18:11:03 -0000 On Monday 17 April 2006 19:48, 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. In addition with the other suggestions, an sh(1)-only sollution is this: $ username=smmsp $ eval homedir=~${username} $ echo $homedir /var/spool/clientmqueue > > 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. That's very "basy", isn't it? HTH, Nikos