Eric Blake wrote: > Even if your system allows shell metacharacters in usernames, tilde > expansion does not. ----
I never thought of that -- I seemed like there should be a getxxxx command that access the appropriate library by using your systems's configuration. Unfortunately, it looks like it might be SuSE only, though you could grab the latest source for it -- it's in their glibc-2.17 package, so the source for that would be: http://download.opensuse.org/factory/repo/src-oss/suse/src/glibc-2.17-10.2.src.rpm I've seen similar utils for nis/yp, but not one that was "general" to work with glib which uses the OS's preferred lookup methods. It does handle metacharacters (spaces, '$' and '\' tested): > getent passwd 'Domain Administrator' Domain Administrator:x:500:18:Domain Admin accnt:/home/root:/bin/bash > getent passwd 'NtDom$' NtDom$:x:50505:516:S-1-5-21-33333-77777-33333:/var/lib/nobody:/bin/nologin > getent passwd 'NtDom\root' NtDom\root:x:0:0:root:/root:/bin/bash --- Certainly is another place where NUL terminated strings would be useful for holding any returned value.