home directory
Craig White
craigwhite at azapple.com
Fri Dec 19 17:03:45 UTC 2008
On Fri, 2008-12-19 at 16:40 +0000, Alan Cox wrote:
> > try 'echo ~/$LOGNAME' to get logged in user and directory
>
> As you'd notice if you tried it before posting this doesn't work and
> couldn't possibly work.
----
why would he want to give advice that actually works?
This is something that I've worked through...
#!/bin/sh
#
getent passwd | awk -F: '$3 > 499 && $3 < 10000 \
{ print $1 }' | grep -v '\$' > /tmp/users
Which just gives me a list of known users with uid between 500 and
10000...
A slight adjustment gives me their home directories...
getent passwd | awk -F: '$3 > 499 && $3 < 10000 \
{ print $1" - "$6 }' | grep -v '\$'
which might be useful to OP noting that I use the 'grep -v '\$' to
remove the Samba/Domain Workstations and that I use LDAP rather and
therefore am using getent rather than 'cat' the file /etc/passwd.
Or lastly, this might be useful...
# cat users_get_home
#!/bin/sh
#
getent passwd | grep $1 | awk -F: '{ print $6 }'
# ./users_get_home craig
/home/users/craig
Craig
More information about the fedora-list
mailing list