Re: home directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux