The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 04-15-2008
cfajohnson's Avatar
cfajohnson cfajohnson is online now Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,312
Quote:
Originally Posted by Franklin52 View Post
If you want to ls for directories of the homedirectory of user $1:

Code:
ls -ld $(grep "$1" /etc/passwd | cut -d: -f6)

There's no need to look at /etc/passwd or to use an external command (unless your shell doesn't have printf built in):

Code:

eval "printf '%s\n' ~$1/*/"