Date: Mon, 17 Apr 2006 21:09:22 +0300 From: Nikos Vassiliadis <nvass@teledomenet.gr> To: freebsd-questions@freebsd.org Subject: Re: getting a user's home dir (sed/awk?) Message-ID: <200604172109.22366.nvass@teledomenet.gr> In-Reply-To: <4443C6D6.3040707@locolomo.org> References: <4443C6D6.3040707@locolomo.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604172109.22366.nvass>