Comments on: How to emulate Unix’ getent with MacOSX’s dscl http://zzamboni.org/brt/2008/01/21/how-to-emulate-unix-getent-with-macosxs-dscl/ Musings about technology and other neat stuff Tue, 29 Sep 2009 21:48:06 +0200 http://wordpress.org/?v=2.8.4 hourly 1 By: yvov http://zzamboni.org/brt/2008/01/21/how-to-emulate-unix-getent-with-macosxs-dscl/comment-page-1/#comment-12251 yvov Thu, 29 Jan 2009 22:42:26 +0000 http://zzamboni.org/brt/2008/01/21/how-to-emulate-unix-getent-with-macosxs-dscl/#comment-12251 #!/bin/bash if [ -z $1 ]; then echo "You must specify an user" exit 1 else echo `dscl . -read /Users/$1 RecordName | sed 's/RecordName: //g'`:*:`dscl . -read /Users/$1 UniqueID | sed 's/UniqueID: //g'`:`dscl . -read /Users/$1 PrimaryGroupID | sed 's/PrimaryGroupID: //g'`:`dscl . -read /Users/$1 RealName | sed -e 's/RealName://g' -e 's/^ //g' | awk '{printf("%s", $0 (NR==1 ? "" : ""))}'`:/Users/$1:`dscl . -read /Users/$1 UserShell | sed 's/UserShell: //g'` fi exit 0 #!/bin/bash

if [ -z $1 ];
then
echo "You must specify an user"
exit 1
else
echo `dscl . -read /Users/$1 RecordName | sed 's/RecordName: //g'`:*:`dscl . -read /Users/$1 UniqueID | sed 's/UniqueID: //g'`:`dscl . -read /Users/$1 PrimaryGroupID | sed 's/PrimaryGroupID: //g'`:`dscl . -read /Users/$1 RealName | sed -e 's/RealName://g' -e 's/^ //g' | awk '{printf("%s", $0 (NR==1 ? "" : ""))}'`:/Users/$1:`dscl . -read /Users/$1 UserShell | sed 's/UserShell: //g'`
fi

exit 0

]]>